havenphillip Posted February 18, 2019 Share Posted February 18, 2019 How to use the underwater shader? Is it like a post effect or attach it to a box or something? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 18, 2019 Share Posted February 18, 2019 It's a post effect you can attach to your scene or active by code. Fair warning that the one that comes with Leadwerks doesn't (or didn't) have an underwater effect so it looks bad when you're underwater. You can find one I think on the workshop or on the forums from shadmar that includes that too. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 18, 2019 Author Share Posted February 18, 2019 I tried it as a post effect but I just get a black screen. What do you make of that? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 18, 2019 Share Posted February 18, 2019 To be clear, you're talking about one you found online, right (since the one that comes with Leadwerks doesn't do underwater)? Can you link to the one you're trying to use? Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 18, 2019 Author Share Posted February 18, 2019 What's the underwater shader about if it doesn't do underwater? I'm talking about the one that is in the Leadwerks shaders. This one: Shaders/Water/underwater.shader Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 18, 2019 Share Posted February 18, 2019 Oh ok. I'm not sure what that one is meant to do but I noticed that it's not under the Post Effects folder (if I add it to a scene in the editor, it seems to stop updating). I've been using one that shadmar shared online and possibly on the workshop. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 18, 2019 Author Share Posted February 18, 2019 Ah ok. What's the one you were talking about earlier that comes with Leadwerks but doesn't look very good? I have the Shadmar shader. But I wanted to compare it to something else so that I can learn shaders. When I look at it it just looks like nonsense to me. I wish there were more tutorials and shader packs I could get my hands on so I could mess with them. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 18, 2019 Author Share Posted February 18, 2019 You don't happen to have Shadmar's shader pack that had rain and day/night cycle do you? or know where I can get it? Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted February 18, 2019 Share Posted February 18, 2019 Here is a Youtube series on shaders using Leadwerks. Shadmar removed his shaders sometime ago. He was unable to update them to the workshop and the developed some glitches. Maybe he might like to fix them and sell them on the market place 1 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 18, 2019 Share Posted February 18, 2019 2 hours ago, havenphillip said: What's the one you were talking about earlier that comes with Leadwerks but doesn't look very good? Just the one that Leadwerks activates when you add water to a scene. If you move the camera underwater, there is no blue/swaying effect at all. By the way, shadmar uploaded a version to dropbox some months after that discussion Thirsty Panther linked. The post is here: https://www.leadwerks.com/community/topic/10334-day-and-night-cycle-shader/?do=findComment&comment=106706 I believe that's the latest version but someone let me know if that's not the case. 1 Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 18, 2019 Share Posted February 18, 2019 I think a while back I just used the wobble.shader in the stock assets. The trick is checking if the camera is below the world's water level and applying/removing the effect respectively. You can also use the engine fog system with the wobble shader and get a decent result. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
havenphillip Posted February 19, 2019 Author Share Posted February 19, 2019 I did watch that tutorial. It was pretty good. I grabbed that Day/Night shader. I was hoping it had the rain shader attached to it. I found this snow shader online and was able to get it working but I can't figure out how to get rid of the grey background. It works as a PostEffect but pretty much useless thus far. #version 400 uniform float currenttime; uniform vec2 buffersize; float time=currenttime/1000.0; out vec4 fragData0; float snow(vec2 uv, float scale, float time) { float w=smoothstep(1.0,0.0,-uv.y*(scale/10.0));if(w<.1)return 0.0; uv+=time/scale;uv.y+=time*2.0/scale;uv.x+=sin(uv.y+time*.5)/scale; uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.0,d; p=.5+.35*sin(11.0*fract(sin((s+scale)*mat2(vec2(7,3),vec2(6,5)))*5.0))-f;d=length(p);k=min(d,k); k=smoothstep(0.0,k,sin(f.x+f.y)*0.01); return k*w; } void main(void) { vec2 uv=(gl_FragCoord.xy*2.0-buffersize.xy)/min(buffersize.x,buffersize.y); float c=smoothstep(1.0,0.3,clamp(uv.y*.3+.8,0.0,.75)); c+=snow(uv,30.0,time)*.3; c+=snow(uv,20.0,time)*.5; c+=snow(uv,15.0,time)*.8; c+=snow(uv,10.0,time); c+=snow(uv,8.0,time); c+=snow(uv,6.0,time); c+=snow(uv,5.0,time); vec3 finalColor=(vec3(c)); fragData0 = vec4(finalColor,1.0); } //vertex #version 400 uniform mat4 projectionmatrix; uniform mat4 drawmatrix; uniform vec2 offset; uniform vec2 position[4]; uniform float currenttime; in vec3 vertex_position; out float time; void main(void) { gl_Position = projectionmatrix * (drawmatrix * vec4(position[gl_VertexID]+offset, 0.0, 1.0)); } Quote Link to comment Share on other sites More sharing options...
Russell Posted February 21, 2020 Share Posted February 21, 2020 On 2/18/2019 at 11:31 PM, reepblue said: I think a while back I just used the wobble.shader in the stock assets. The trick is checking if the camera is below the world's water level and applying/removing the effect respectively. You can also use the engine fog system with the wobble shader and get a decent result. Hi there team!! Hi there Reepblue!! I'm working on my project trying to make this idea. Using WOBBLE.SHADER effect only underwater... But i don't know how check if the camera is below the world's water level. And more less how apply or remove effect by code... Any clue so I can get it??? This is the starting design for my idea: Quote Link to comment Share on other sites More sharing options...
Marcousik Posted February 23, 2020 Share Posted February 23, 2020 Hey Man you have to check the scripts tutorials, you will find so much what you can do! https://www.leadwerks.com/learn?page=API-Reference_Object_World_GetWaterHeight https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_Camera_AddPostEffect 1 Quote Link to comment Share on other sites More sharing options...
Russell Posted February 23, 2020 Share Posted February 23, 2020 1 minute ago, Marcousik said: Hey Man you have to check the scripts tutorials, you will find so much what you can do! https://www.leadwerks.com/learn?page=API-Reference_Object_World_GetWaterHeight https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_Camera_AddPostEffect Yeah, i have check those links and another ones, but my problem is that i'm new in LUA and I fail in the syntax when i encode them in my scripts. For examplen for underwater i wanted use WOBBLE.SHADER adding it with a COLLISION TRIGGER. To simulate we are dry, and we enter to water. My codes fail a lot because the sintax. And finally with help of the forum (especially Josh give me this) i have use the correct code for solve my case: function Script:Collision(entity, position, normal, speed) if self.enabled then if entity.script ~= nil then if entity.script.camera ~= nil then entity.script.camera:AddPostEffect("Shaders/PostEffects/wobble.shader") self.enabled = false end end end end I love you guys!! I'm learning a lot about LUA sintax. ☺️☺️☺️☺️ 1 Quote Link to comment Share on other sites More sharing options...
shadmar Posted February 24, 2020 Share Posted February 24, 2020 There are water shaders in Dino Land you can steal (whole game is unencrypted) I believe the rest of the sahders are also there. 3 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Russell Posted February 24, 2020 Share Posted February 24, 2020 32 minutes ago, shadmar said: There are water shaders in Dino Land you can steal (whole game is unencrypted) I believe the rest of the sahders are also there. But Steal is a horrible word ???? Anyway thanks!! I will look the code of shaders to learn from them, if I don't need it anymore because I have finished the underwater area of my game. Used the default stuff has Leadwerks inside it. (I think wobble.shader is developed by you Shadmar) This is the final result of yesterday work (thank you very much team with the help about sintax of how use addposteffect). I'm very satisfied with it: 3 Quote Link to comment Share on other sites More sharing options...
Russell Posted February 24, 2020 Share Posted February 24, 2020 @shadmar incredible Dino land!! I don't need now, but in the future in another "minigame" or level in my museum, would you give me your permission to use the camera model and fps hands??? They are cool!! Quote Link to comment Share on other sites More sharing options...
shadmar Posted February 25, 2020 Share Posted February 25, 2020 20 hours ago, Russell said: @shadmar incredible Dino land!! I don't need now, but in the future in another "minigame" or level in my museum, would you give me your permission to use the camera model and fps hands??? They are cool!! They are made by @tjheldna so it's not my permission to give. But you can use the shaders to your liking if not otherwise is staded in them. 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Marcousik Posted February 25, 2020 Share Posted February 25, 2020 Hey Russel Nice showcase. How did you do the floor reflections may I ask? It s cool and realistic Quote Link to comment Share on other sites More sharing options...
adebgamesoft Posted February 26, 2020 Share Posted February 26, 2020 9 hours ago, Marcousik said: Hey Russel Nice showcase. How did you do the floor reflections may I ask? It s cool and realistic add ssr shader on post effects Quote Link to comment Share on other sites More sharing options...
Russell Posted February 26, 2020 Share Posted February 26, 2020 12 hours ago, Marcousik said: Hey Russel Nice showcase. How did you do the floor reflections may I ask? It s cool and realistic As adebgamesoft said, i have use SSR.SHADER (inside our Leadwerks) on PostEffects area inside ROOT. (It's a Shader like GODRAYS, SSAO o WOOBLE) Anyway, to take advantage of the effect, be sure work and create diffuse and Normal textures, with this the shader works well and we will get that aspect and relief on the reflection of the SSR.SHADER. But if you create and use too Specular and Displacement textures, you will get better effect of relief with the reflections of the shader. 1 Quote Link to comment Share on other sites More sharing options...
Marcousik Posted February 26, 2020 Share Posted February 26, 2020 Right thx adebgamesoft and Russel Actually it would be nice to use this shader on a specific material as it seems to turn the entire scene to marble: It is so impossible to compose a scene with old creepy material and marble 1 Quote Link to comment Share on other sites More sharing options...
Russell Posted February 26, 2020 Share Posted February 26, 2020 Just now, Marcousik said: Right thx adebgamesoft Actually it would be nice to use this shader on a specific material as it seems to turn all the scene to marble: It is so impossible to compose a scene with old creepy material and marble You don't need specify material for the Shader... You can change the textures are you using for SSR doesn't work on CREEPY material or old Wood or Cloth textures... For example in my game, this reflections don't work on my Cloth textures or rought Stone material... But you need play with the diferent types of textures you can create on your MATERIALS. Quote Link to comment Share on other sites More sharing options...
Russell Posted February 26, 2020 Share Posted February 26, 2020 9 minutes ago, Marcousik said: Right thx adebgamesoft Actually it would be nice to use this shader on a specific material as it seems to turn all the scene to marble: It is so impossible to compose a scene with old creepy material and marble Here... Example only using DIFFUSE texture on our material (the skin on Triceratops). The SSR make the skin shiny and with reflection. But if we work NORMAL and SPECULAR textures for the same Material, SSR doesn't work on them. Example on the same Material (the Skin of Triceratops): It's pure desing, not programation... ? 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.