-
Posts
556 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by havenphillip
-
What do you mean? You're not getting any shadows? Which ground shader?
-
Mine says "NONE - opt out of all beta programs." I do have that shader, too.
-
I don't know. How would I check that? I tried it with that other script. It got too complicated and I gave up. I couldn't manage to isolate the skybox.
-
What do you mean? Collapse with the scene? I hadn't tried this script on more than one entity at a time and it looks like you can't do more than one. Not sure why. Adjusting the settings on one entity adjusts the settings on others. I thought each instance of the script in play would affect only the entity it was attached to. It works better I guess just to leave the lua out of it.
-
Almost forgot that script works with these. The same as the last. I just remembered to write "uniform" in front of some things: Parallax POM.zip
-
Here's a lua script to attach to stuff for the shader: Script.diffuse = "" --path "Diffuse Map" "Texture File (*tex):tex|Texture" Script.normal = "" --path "Normal Map" "Texture File (*tex):tex|Texture" Script.specular = "" --path "Specular Map" "Texture File (*tex):tex|Texture" Script.height = "" --path "Height Map" "Texture File (*tex):tex|Texture" Script.diffuseColor = Vec4(0.4,0.4,0.5,1.0) -- color "Diffuse Hue" Script.brightness = 2.0 -- float "Brightness" Script.specIntensity = 3.0 -- float "Specular Intensity" Script.parallaxSteps = 10 -- float "Parallax Steps" Script.parallaxDepth = 0.03 -- float "Parallax Depth" Script.parallaxRounding = 0.2 -- float "Parallax Rounding" Script.texSize = 1.5 -- float "Texture Size" function Script:Start() self.shader = Shader:Load("Parallax/parallax_economy.shader") --self.shader = Shader:Load("Parallax/parallax.shader") --surface = self.entity:GetSurface(0) -- for models surface = self.entity:GetFace(0) --for brushes mat = surface:GetMaterial() self.entity:SetMaterial(mat) mat:SetTexture(self.diffuse,0) mat:SetTexture(self.normal,1) mat:SetTexture(self.specular,2) mat:SetTexture(self.height,3) mat:SetShader(self.shader) self.shader:SetVec4("diffuse_hue", self.diffuseColor) self.shader:SetFloat("diffuse_brightness", self.brightness) self.shader:SetFloat("specular_intensity", self.specIntensity) self.shader:SetInt("parallax_steps", self.parallaxSteps) self.shader:SetFloat("parallax_depth", self.parallaxDepth) self.shader:SetFloat("parallax_rounding", self.parallaxRounding) self.shader:SetFloat("texture_size", self.texSize) end function Script:Release() self.shader:Release() mat:Release() end
-
There's a bloom.lua and a bloom.shader in my post effects folder. I assumed those came with Leadwerks. I don't know where I got them, then. I'll see if I can make it work with the one you posted. I have that one, too, somehow. This is the one I'm using: ----------------------------- -- Simple post effect script ----------------------------- --Called once at start function Script:Start() --Load this script's shader self.shader = Shader:Load("Shaders/PostEffects/bloom.shader") self.shader_hblur = Shader:Load("Shaders/PostEffects/hblur.shader") self.shader_vblur = Shader:Load("Shaders/PostEffects/vblur.shader") self.shader_bright = Shader:Load("Shaders/PostEffects/brightpass.shader") end --Called each time the camera is rendered function Script:Render(camera,context,buffer,depth,diffuse,normals) --Create downsample buffers if they don't exist if self.buffer==nil then local w=buffer:GetWidth() local h=buffer:GetHeight() self.buffer={} self.buffer[0]=Buffer:Create(buffer:GetWidth(),buffer:GetHeight(),1,0) self.buffer[1]=Buffer:Create(w/2,h/2,1,0) self.buffer[2]=Buffer:Create(w/4,h/4,1,0) self.buffer[3]=Buffer:Create(buffer:GetWidth(),buffer:GetHeight(),1,0) end --Save for bloom pass buffer:Disable() --Brightpass self.buffer[0]:Enable() self.shader_bright:Enable() diffuse:Bind(1) context:DrawImage(diffuse,0,0,buffer:GetWidth(),buffer:GetHeight()) self.buffer[0]:Disable() --Downsample self.buffer[0]:Blit(self.buffer[1],Buffer.Color) self.buffer[1]:Blit(self.buffer[2],Buffer.Color) self.buffer[2]:Blit(self.buffer[3],Buffer.Color) --hblur self.buffer[0]:Enable() self.shader_hblur:Enable() self.buffer[3]:GetColorTexture():Bind(1) context:DrawImage(self.buffer[3]:GetColorTexture(),0,0,buffer:GetWidth(),buffer:GetHeight()) self.buffer[0]:Disable() --vblur self.buffer[3]:Enable() self.shader_vblur:Enable() self.buffer[0]:GetColorTexture():Bind(1) context:DrawImage(self.buffer[0]:GetColorTexture(),0,0,buffer:GetWidth(),buffer:GetHeight()) self.buffer[3]:Disable() --bloom buffer:Enable() self.shader:Enable() diffuse:Bind(1) tex=self.buffer[3]:GetColorTexture() tex:Bind(2) context:DrawImage(self.buffer[3]:GetColorTexture(),0,0,buffer:GetWidth(),buffer:GetHeight()) end --Called when the effect is detached or the camera is deleted function Script:Release() if self.shader then self.shader:Release() self.shader = nil end if self.shader_vblur then self.shader_vblur:Release() self.shader_vblur = nil end if self.shader_hblur then self.shader_hblur:Release() self.shader_hblur = nil end if self.shader_bright then self.shader_bright:Release() self.shader_bright = nil end --Release buffers if self.buffer~=nil then self.buffer[0]:Release() self.buffer[1]:Release() self.buffer[2]:Release() self.buffer[3]:Release() self.buffer=nil end end Then the bloom shader is : //Fragment #version 400 uniform sampler2D texture0; uniform sampler2D texture1; uniform sampler2DMS texture2; uniform bool isbackbuffer; uniform vec2 buffersize; uniform float currenttime; uniform float intensity = 4.0; out vec4 fragData0; void main(void) { vec2 coord = vec2(gl_FragCoord.xy/buffersize); if (isbackbuffer) coord.y = 1.0 - coord.y; ivec2 icoords = ivec2(coord * buffersize); vec4 blur0 = texture(texture0,coord); vec4 scene = texture(texture1, coord); // rendered scene vec4 blur2 = texelFetch(texture2, icoords, 0); //glowmap fragData0 = clamp((scene+blur2*(blur0*intensity)),0.0,0.9); } //Vertex #version 400 uniform mat4 projectionmatrix; uniform mat4 drawmatrix; uniform vec2 offset; uniform vec2 position[4]; in vec3 vertex_position; void main(void) { gl_Position = projectionmatrix * (drawmatrix * vec4(position[gl_VertexID]+offset, 0.0, 1.0)); }
-
Did you ever solve this? I came up with one possible solution with a little adjustment to the bloom shader that I believe is the one that comes with Leadwerks. You just have to change the fragment part to this: #version 400 uniform sampler2D texture0; uniform sampler2D texture1; uniform sampler2DMS texture2; uniform bool isbackbuffer; uniform vec2 buffersize; uniform float currenttime; uniform float intensity = 4.0; out vec4 fragData0; void main(void) { vec2 coord = vec2(gl_FragCoord.xy/buffersize); if (isbackbuffer) coord.y = 1.0 - coord.y; ivec2 icoords = ivec2(coord * buffersize); vec4 blur0 = texture(texture0,coord); vec4 scene = texture(texture1, coord); // rendered scene vec4 blur2 = texelFetch(texture2, icoords, 0); //glowmap fragData0 = clamp((scene+blur2*(blur0*intensity)),0.0,0.9); } /* //original shader #version 400 uniform sampler2D texture1; uniform sampler2D texture2; uniform bool isbackbuffer; uniform vec2 buffersize; uniform float currenttime; uniform float intensity = 2.0; out vec4 fragData0; void main(void) { vec2 icoord = vec2(gl_FragCoord.xy/buffersize); if (isbackbuffer) icoord.y = 1.0 - icoord.y; vec4 scene = texture(texture1, icoord); // rendered scene vec4 blur = texture(texture2, icoord); // glowmap fragData0 = clamp(scene + (blur*intensity), 0.0, 1.0); }*/
-
Ok last one all nice and tidy so you can delete all the above if you prefer. I put in the regular and economy versions and two textures to mess with just as examples. I left out the cobblestone texture, though. The regular parallax has the edge texture in it uncommented in case you want to check it out. It looks good but it cuts the FPS in half. The economy version is an attempt to get max speed without making it look too bad, and it really doesn't look too bad at all unless you compare it to the other one, but it's clearly the more workable option. Parallax.zip
-
I just figured out how to get even more speed. So now I'm going to backtrack from the parallax_economy shader and see how much I can put back into it without losing that speed. I'll post the final shader either today or tomorrow.
-
Honestly I'm just learning that as I go. But as Josh mentioned, this shader is technically "parallax occlusion" (POM), or maybe "steep parallax." Pretty much all I know is it requires an extra matrix-to-eye calculation and the way I understand it it uses the z coordinate of the "eye" to produce a perception of depth like a raycast.
-
Here's another version I built for speed. I took out a lot of the bells and whistles. I was also doing a bunch of pointless calculations in the matrix. It's a little faster but unfortunately it requires sacrifices. Would be nice if Josh could find us a few FPS points somewhere so stuff like this could be used more widely. LE would look amazing. parallax_economy.zip
-
I use Materialize. It's free. 3 tutorials you should have it mastered. http://boundingboxsoftware.com/materialize/downloads.php http://boundingboxsoftware.com/materialize/tutorials.php I used a slightly different diffuse texture when I made the normal map (protuberance), which I doctored in GIMP to exaggerate the contrast and then discarded. So it makes sense that the LE normal map wouldn't work the same. See how this one is brighter?
-
Check out this updated one with the edge texture Parallax.zip
-
Added an edge texture which I made in GIMP. It looks remarkably good in-game even with texture settings set to low and standing right up to it. I'm working right now on fixing the color change to offset the loss of brightness by adding the map. It was pretty easy to make. In GIMP I opened the diffuse texture, then went to Filters/Distorts/Emboss, and set the elevation to 90 so the edges were evenly dispersed. easy to code, too. You just mix it with the diffuse: ... vec4 edge = texture(texture4,texcoords0.xy); edge = mix(edge,outcolor,1.0-edge_amount); ... //Output fragData0 = outcolor; fragData0 *= edge; ... Zoom in on this I'm fining it ridiculous how close I can get to this texture without it looking like a pixelated mess. Might be worth it to include an edge texture generator in LE5.
-
That decal looks like it's working. So far so good. Hadn't seen you in a while, Yue, I was worried. I've heard of AMD but I'm not sure what that means, exactly. It's parallax, though. It shouldn't be too expensive to run.
-
Thanks dude it's a magical world of bewilderment. I dig this stuff up piecemeal but I'm going to go back and find some more tutorials to see if I can make better sense of it.
-
Super easy to use. You just slap it on a material and slap that material on an object. You gotta have a heightmap. I make mine on Materialize, which is free. Makes simple, wimpy flat planes look more complex than they are. Haven't tested it for any FPS drop or with decals or anything. Should be fun to mess with, though. Parallax.zip
-
Hey Josh I know you're busy and I keep bugging you with this but could you explain real quick how I get the seams so I can disable displacement on them. I've been looking everywhere and can't seem to find the answer. This is my displacement code: //Vertex displacement //----------------------------------------------------------------- vec4 height = texture(texture3,ex_texcoords0); float offset = (height.r + height.g + height.b)*0.025; vec4 newPos = vec4(modelvertexposition.xyz + vNormal* offset,1.0); if (height.r > 0.5) { gl_Position = projectioncameramatrix * newPos; } //-------------------------------------------------------------------
-
Dude, how do I get the seams? and then use vertex alpha to control the displacement? What is it? Like length(texcoords) or something? Do you have a code example or even a shader you'd be wiliing to impart? Or a webpage or tutorial somewhere that shows an example? That would be awesome. I learned how to displace but after reading your article I just assumed you needed "per-vertex" which I thought meant you have to subdivide. I've been scouring the internet for geometry shader examples for subdivision and tesselation shaders. I imagine the new engine will be much faster, and therefore better for this kind of thing, but I'm still trying to wrap my head around LE4.
-
I wish I knew shaders well enough to make something like that. I messed with the tesselation shader and found some geometry shaders but I can't see how to take care of those cracks in the seams. If you integrated this into Leadwerks 4 and sold it as an add-on I'd buy it. 20 bucks. These texture editors make your heightmaps look cool but then you bring it to Leadwerks and you lose a little bit in translation. Then again, it might serve better strictly as a selling point for LE5. Sounds like you got some ground-breaking stuff going on over there. Either way Turbo look great. Two thumbs up.
-
Would it be difficult to do this for regular Leadwerks as well? It just looks really cool. It
-
I'm pretty sure there's a way to use the groundrocks shader on your material to create a billboard so that you can paint the rocks on terrain. Seems like I did that before.
-
What might be cool is if you had a view of the whole planet that you could bring up, and then clicking different points on the planet would load different maps, giving the impression somewhat that you're going all over the place.