Graphics Shaders for hobby programmers: Newest Video: LUT maps

Joe Ellis

Member
Actually we're passing in a texture, take samples from the current fragment and surrounding fragments on that texture and draw the result to a different texture.
In example in the very first blur shader (the very ugly inefficient one) in "obj_blur_1_pass_isoweight_discrete"s draw event we drew a sprite texture to the application surface. So the original texture, the sprite, remains unchanged. Same goes for all other blurs in this series.

Afaik you shouldn't draw to the same texture as the one you're drawing (I don't know for sure, just read you shouldn't). So you shouldn't i.e. do this:
surface_set_target(srf_main);
shader_set(shd_cool_gfx);
draw_surface(srf_main);
shader_reset();
surface_reset_target();

I don't know if you can do that at all, but if you can:
Afaik you can't control the order in which the fragments are drawn. I read somewhere that the cores on the GPU just pick any unprocessed fragment and when they're done pick any other unprocessed fragment. So they're not processed one by one from top left to bottom right or the like if I understood that correctly.

But as I keep mentioning, I'm no pro in shader stuff; just sharing what I learned and read :)
I found you can't read a surface that you're writing to, ei.

surface_set_target(Hello_guys)

meanwhile in shader:

uniform sampler2D Hello_guys;

Color = texture2D(Hello_guys, vvtexcoord)


Can't remember if it crashed or just returned 0, but not good either way
 
Oooh, this is really nice. I'm working on a project and looking for a shader like this one. Nice work, I'll have to come back here when we reach that stage of devlopment!
 
Just added a new Video.

Ever wondered how the heck you can use v_vTexcoord to get samples from a second texture on a different mixed texture page?
This time is about remapping UVs from one sprite to another to solve that problem and using vertex buffers as another approach.

Kinda long, kinda boring, quite important though :)
 
Awesome tutorials Reverend!

Just had a quick question. I skimmed thru the vids and noticed that the base sprite you used in the tutorials did not have any transparent regions. A square like sprite like that of a menu box may have different outcomes than a sprite of a non-square character, which would have transparent areas. Just wondering if the same results could be achieved with both types of sprites. In past experience with shaders, this has been an important distinction.

Thanks and looking forward to the burning dissolve style luma tutorial!
 
Damn that looks nice!

Yes, I meant to say about the luma masks. Glad to hear it works with sprites containing not only transparent regions but semi transparent as well.
 

Shut

Member
Whoa, awesome work! Thanks a lot for sharing, the dissolve shader looks really cool. I might use it for some transition effects in Kontrakt.
 
How compatible are the Day-Light tutorials with GMS1? I took a look at your video and it seems you make heavy use of layers.
The shader code stays the same.
As for layers, just think of them as depth. If you know your way around in GMS 1 you'll see you need to make only a few changes. The gpu functiins are named differently and the two layer scrpts can be replaced with objects at a slughtly higher andvslightly lower depth than the depth of the tile set.
 

Biosyn

Member
Great job with adding the lights to the day and night shader.

Really curious on how you'd tackle normals if you do them.
 
K

kagiol94

Guest
Awesome stuff Reverend! Bloom is definitely one of those must have shaders imo.

Thanks for the tutorial!
 

samspade

Member
Just want to say that I've been working my way through these for several months now and its one of the best tutorial series there is for game maker, and not just for shaders (though they are also great and I've been using a number of them). There are a lot of other things you pick up along the way ranging from things like working in strictly typed languages and math to incredibly helpful things in the room editor (learning how to alt select has probably saved me hours by itself and it works in other platforms as well). The videos or portions of videos that work through how to learn things are also very good. I've taken many concepts form the test project itself and used them to create similar in game editors for my own projects. Overall, just very good work and I appreciate it a lot.
 
Amazing stuff Reverend, do you have any tutorials on radial distortion, like a shockwave effect?
Would like to distort some explosions, but no idea where to start.
 
Amazing stuff Reverend, do you have any tutorials on radial distortion, like a shockwave effect?
Would like to distort some explosions, but no idea where to start.
Not yet. I do have a shockwave video in planning but it'll take probably 6 weeks til i get to that. It does look pretty cool though :)
 
Just reflecting what has already been said above, hats off.
Look forward to the next tutorial, and massive respect for sharing work of this quality.
 
Thank you for great work i was viewed some videos its
I have issue with alpha or alpha blend on png transparnt textures such : tree when i draw trees model with shader or default pass through shader the alpha its missed and draw with out alpha this issue was happened with me on android and ios platform but on windows its work fine btw iam talking about 3d mode iam used gms1.4 do you have video dealing with alphablend and shader on android or ios in 3d mode .sorry for long comment and thanks
 
Thank you for great work i was viewed some videos its
I have issue with alpha or alpha blend on png transparnt textures such : tree when i draw trees model with shader or default pass through shader the alpha its missed and draw with out alpha this issue was happened with me on android and ios platform but on windows its work fine btw iam talking about 3d mode iam used gms1.4 do you have video dealing with alphablend and shader on android or ios in 3d mode .sorry for long comment and thanks
Unfortunately I can't help you there. I have absolutely no experience with 3D stuff. But if you create a new post on the programming forum and provide a good description of your problem and images, there's a good chance you'll get help. There are a few really great 3D cracks around.
 
Thank you fore replay I have this issue since two years ago and I post in old forum but I do not get solution
I will post new with full detail as soon thanks
 
Just added a new Video.

preview_04.png

This time is not about coding a shader but about what normal maps for 2D games are so we're pepared for the next video where we'll create a shockwave shader with normal maps.

After the video you can alo have a look at the interactive explanation. It'lll help really understanding normal vectors:
https://reverend-greg.itch.io/normal-maps-explained

But just to make that clear: I don't plan to create a lighting shader using normal maps.
 

Biosyn

Member
Thank you for the video on the normal map explanation. Looking forward to the shock wave tutorial.

I know you've said you don't plan to create a lighting shader with normal maps, but I hope you will reconsider sometime down the line.

Thanks for all your tutorials thus far!
 
Last edited:

Edwin

Member
Just added a new Video.

View attachment 24102

This time is not about coding a shader but about what normal maps for 2D games are so we're pepared for the next video where we'll create a shockwave shader with normal maps.

After the video you can alo have a look at the interactive explanation. It'lll help really understanding normal vectors:
https://reverend-greg.itch.io/normal-maps-explained

But just to make that clear: I don't plan to create a lighting shader using normal maps.
Hello, can you please explain how pixel interpolation / image scaling works? I can not find the answer for a long time.
 
I know you've said you don't plan to create a lighting shader with normal maps, but I hope you will reconsider sometime down the line.
Its really simple with one light. Way more difficult to have multiple lights, make it look good and add shadows and a nice blending and and and ...
The reason why Im not persuing this is because even if you get the technical part going, creating normal maps for every asset is extremely time consuming and so I dont plan to use normal lighting in any game and thus its something I dont plan to spend time on :)

Hello, can you please explain how pixel interpolation / image scaling works?
What do you mean exactly?

Edit:
@Biosyn : If you want to create a normal lighting shader yourself though, this might be a good place to udnerstand how it works: https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson6
But farther than that I can't help. I simply don't now how to add more features :)
 
Last edited:

Edwin

Member
Its really simple with one light. Way more difficult to have multiple lights, make it look good and add shadows and a nice blending and and and ...
The reason why Im not persuing this is because even if you get the technical part going, creating normal maps for every asset is extremely time consuming and so I dont plan to use normal lighting in any game and thus its something I dont plan to spend time on :)


What do you mean exactly?
I always wanted to make a shader that makes pixels smoother but don't know how they work. You know, the filters in some 8 bit consoles emulators.
 
Top