Jump to content

havenphillip

Members
  • Posts

    550
  • Joined

  • Last visited

Everything posted by havenphillip

  1. Here it is on the sphere. You can see it only works where you cut the texture:
  2. I've made it work on squares and rectangles but it's best for planes, like if you have a wall segment and want to spice it up you could do that, but put some pillars on either side. I tried it on a beveled cube but the smoothing breaks the parallax, and I made a wall that had a diagonal 45 degree angle and it couldn't make sense of the angle as I walked past it. It did the same with the parallax shader included with Leadwerks, so I figure that has to do with the TBN matrix. It doesn't like diagonals. Besides that, the cutting system I have is horrible because you have to reset it manually for each shape. I currently have to select the brush, click "Select Face" and then center it. Then I have to unhide the alpha square and adjust the size of it, and you have to get those numbers almost perfect or you go too far and don't cut enough and get gaps, or cut too much and lose the effect. So my problems are the cutting system, the sharp lines along the edges nearest the camera, and the FPS cost. I'd like to get it to a point where it works to maybe round the edges of the quad in the shader and generally solve the edge problems. I'm not that good though so it may take me awhile.
  3. Maybe a better explanation: I overlayed the two images so you can see it's all inside the geometry. The space you can see between the red line and the yellow line are actually repetitions of the texture which you can only see because the parallax "sinks in" the texture. You're actually seeing beyond the boundary of the quad. So all I'm cutting are those (infinite, I presume) repetitions of the texture that wouldn't normally be seen anyway.
  4. Thanks, man. It took a long time to get it there.
  5. Dude I sit and drool over the stuff you're making over there. I'll gladly try it with some of your stuff.
  6. The trouble is getting the edges of the quad. But once you have that you can just shrink in a tiny bit and cut them off. My "alpha" is a black box that spans out from the center of the texcoords. Cut them too much and you start to see the gaps. The parallax effect is due to a depth coordinate, so it's actually sunk into the surface of the quad. So all I'm doing is cutting the repetitions of the texture beyond the quad. : quad_edge_sizing = -quad_edge_sizing; vec2 texcoord = abs(parallaxed_texcoords0.xy-0.85)*2.0/texture_size; float leftRight = clamp((quad_edge_sizing.x + texcoord.x - 1.0), 0.0, 1.0); float upDown = clamp((quad_edge_sizing.y + texcoord.y - 1.0), 0.0, 1.0); float alpha = clamp(leftRight + upDown, 0.0, 1.0); if (alpha > 0.0) discard;
  7. Was able to get self-shadowing on the parallax and cut the edges to give it a more 3D look. The shadows slowed it down, and the edge-cutting system isn't really developed at all. There may be better ways to do it. Right now it's mostly just something to look at and poke at. If you open the shader there's a bunch of variables at the top like the light direction(in the vertex shader), the shadow alpha, depth, etc. Still want to find a cheap way to soften the shadows and maybe find a way to round/smooth those sharp mesh edges, as well as get it faster, etc. Also I tried to break down the shader into sections to make it easier to mess with and to see which segment does what. I didn't feel like I quite got the depth before as when I saw some videos of other parallax shaders they looked way better. I'm getting there, though. The picture is the previous parallax/current parallax: Parallax Rocks.zip
  8. I have this parallax shader and got shadows working on it from the heightmap, but my question is is there a directional light uniform that allows me to grab the directional light rotation from the shader? I'm getting some light direction conflict. Also any information on softening shadow edges?
  9. There's this merc. He's got animations.
  10. Couldn't you set the model as a prefab then drag/drop that?
  11. So wait you're actually making 3d models and then creating 2d textures from them?
  12. These are top-notch. How are you making those initial designs?
  13. I know the screen space reflection shader looks for a specular texture. In around line 76: //Get specmap from gbuffer float specularity = texelFetch(texture3, ivec2(icoord*buffersize),0).a; //only compute if we hvae specularity if (specularity > 0.0f) { I haven't tried this but it could be that you could change the texture to 6 or something and just add your specular on "texture6" in slot 6 in the ones you want to have the reflective effect. Seems like it should avoid everything that doesn't have a specular there.
  14. That looks cool, man. I like how you're just instinctively creating puzzles and effects.
  15. The brushes have scripts on them? You should be able to do something like "self.entity:Hide()" or "self.entity:Show()" Is that not working?
  16. Vertex displacement shader I was able to put together. I mostly just did this for the sake of doing it. Has limitations that parallax doesn't, such as it only works on a subdivided surface, and is a bit slower. Each instance of it will be identical, so it's useful for things like walls where you have repeating surfaces. On the positive it pokes out from the surface, yielding some 3d to surfaces on the edges from the side view. You can grow and stretch the plane. Displacement is based on the height map, and is really sensitive. A clean heightmap is important because discrepancies will be more noticeable at higher displacement levels. Shaders don't really do collision so if the displacement is high you will walk right through it into the plane, but that can be fixed with an invisible box with collision placed around it, or putting it out of reach in your scene. Vertex Displacement.zip
  17. Yes! Do it! I need a shader buddy on here. You could read that if you want. I never did. If you watch all of these (about 30 tutorials) you'll be about where I'm at. I just followed along and wrote the code with them to get it stuck in my memory. I'll help you with whatever I can along the way. These .zip files are the codes from these videos configured to work with Leadwerks. Once you understand how to do that it opens up a lot for you. None for the first set of videos because those are literally Leadwerks tutorials. But if I were you I'd follow along and write the shaders for yourself to get it burned into your memory. Do it, bro! Good luck. I would jump right in here: https://www.youtube.com/watch?v=ThUhCs3LNXo&list=PLWWTOiYlyyL4ymtjySQVQ4v7anhOZjPww I started there. Then I did several of these: https://www.youtube.com/watch?v=ZQpE4GPUR5g&list=PL4neAtv21WOmIrTrkNO3xCyrxg4LKkrF7&index=6 Then I did most of these: https://www.youtube.com/watch?v=u5HAYVHsasc&list=PLGmrMu-IwbguU_nY2egTFmlg691DN7uE5 Lewis Lepton.zip aa_shadertoy tutorials.zip
  18. I haven't seen Klepto's buoyancy but I know that in The Zone there's a floating leaves shader which is essentially a few leaves on a diffuse/alphamask texture which is put on a box that just wobbles, and the box is put in the water. He might be doing something like that. It makes sense to me now that the GPU handles the screen pixels, and not the interactions between objects or collisions themselves. I guess that should have been obvious to me. What I probably need to learn is how to use Shape:PolyMesh.
  19. I see. So trying to get collision out of a shader is pretty much an exercise in futility.
  20. How could I get the material height so that I could set the collision to that height? Is that even a viable option? Would that even work?
  21. Sorry dude I wouldn't even know where to begin. You just try. Sometimes it happens for you. Sometimes it doesn't. I was going to ask you, I'm trying to find a way to get collisions with materials. I saw a post you made about collision with materials for footsteps. Do you remember that? You had this code something like: local mat = Material:Load("Terrain Patch/terrain_patch.mat") local pivot = self.piv pickinfo = PickInfo() local p0 = self.entity:GetPosition(true) local p1 = Transform:Point(0,-0.2,0,self.entity,nil) ---3.84 if self.entity.world:Pick(p0,p1, pickinfo, 0, true, Collision.LineOfSight ) then if pickinfo.surface~=nil then local pickedmaterial = pickinfo.surface:GetMaterial() if pickedmaterial~=nil then local height = pickedmaterial:GetTexture(0):GetHeight() if height>self.entity:GetPosition(true).y then self.entity:Move(0,height*0.007,0) System:Print("It works") end end end end This is my problem, here:
  22. I'm just doing vertex displacement of the y axis on a subdivided model that I imported. I assumed the displacement would affect the model and thus the collision but it just acts like I'm walking on a flat surface. It's really irritating. It seems like a cool idea to me to have a subdivided surface model ready to go, that I can resize and reshape however I want. You can't put materials on the terrain. That's the gist of it. The ability to do that opens its usefulness up a lot. For a small patch I'd want to be able to set a heightmap on it and have it pop up, or put puddles on it or whatever. I want to make a shader that allows me to make small patches of terrain with, and generally learn shaders in the process so I can ultimately make more cool-looking stuff. I need the shaders and scripts etc, first. I just read your post about terrain in LE5. You totally get it. It's gonna be lit. But in the meantime if you could point me to which part of which shader handles the collision in the terrain - or any direction toward the answer - that would be much appreciated. Like something like in this picture I see a heightmap shader on a small square, two box brushes with pom shader, a door, and maybe two models (since the railing could be used twice). I just don't want to have to make a new model for every single little bump in every scene. That's tedious, not fun for me.
  23. I'm working on this bumpy terrain shader. I'm getting some cool little hills but the collision is still totally flat. I assumed the collision would change with the shape of the model displacement but apparently not. How do I adjust collision to match the texture displacement? Even knowing what it's called that I should be looking for would help. I just assume I'm looking for "collision" but I'm not finding answers to this specific problem anywhere. Here's my vertex shader. I don't know if that's helpful. But it would be cool to make little patches of terrain like this because I could use materials on it, which I can't do with the terrain. #version 400 #define MAX_INSTANCES 256 //Uniforms uniform vec4 materialcolordiffuse; uniform sampler2D texture0;//diffuse+height map uniform sampler2D texture3;//height map uniform mat4 cameramatrix; uniform mat4 projectioncameramatrix; uniform mat4 camerainversematrix; uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity; float terrainSize = 4.0; //texture size float verticalScale = 15; float verticalScaleFix = 0.8; //Attributes in vec3 vertex_position; in vec4 vertex_color; in vec2 vertex_texcoords0; in vec2 vertex_texcoords1; in vec3 vertex_normal; in vec3 vertex_tangent; in vec3 vertex_binormal; //Outputs out vec4 ex_vertexposition; out vec4 ex_color; out vec2 ex_texcoords0; out vec2 ex_texcoords1; out float ex_selectionstate; out vec3 ex_normal; out vec3 ex_tangent; out vec3 ex_binormal; out float clipdistance0; out vec3 ex_VertexCameraPosition; void main() { mat4 entitymatrix = entity.matrix[gl_InstanceID]; mat4 entitymatrix_=entitymatrix; entitymatrix_[0][3]=0.0; entitymatrix_[1][3]=0.0; entitymatrix_[2][3]=0.0; entitymatrix_[3][3]=1.0; vec4 ex_vertexposition = entitymatrix_ * vec4(vertex_position,1.0); //entitymatrix[0] = ex_vertexposition; //Transform vectors from local to global space mat3 nmat = mat3(entitymatrix[0].xyz,entitymatrix[1].xyz,entitymatrix[2].xyz);//40 ex_normal = (nmat * vertex_normal); ex_tangent = normalize(nmat * vertex_tangent); //ex_binormal = normalize(nmat*vertex_binormal); ex_binormal = normalize(reflect(-ex_tangent,ex_normal));//cross ex_texcoords0 = ex_vertexposition.xz / terrainSize; float textureheightvalue = (textureLod(texture0, ex_vertexposition.xz,0).r * verticalScale)-4; ex_vertexposition.y += textureheightvalue; //from https://www.leadwerks.com/community/blogs/entry/1166-up-part-1/ vec3 norm = normalize(nmat * ex_normal); vec3 up = vec3(0.0, 1.0, 0.0); float ang = max(dot(norm, up), 0.0); gl_Position = projectioncameramatrix * ex_vertexposition * ang; ex_color = vec4(entitymatrix[0][3],entitymatrix[1][3],entitymatrix[2][3],entitymatrix[3][3]); ex_color *= vec4(1.0-vertex_color.r,1.0-vertex_color.g,1.0-vertex_color.b,vertex_color.a) * materialcolordiffuse; }
  24. Nice. That's what I was hoping. I was pretty sure it would work but I'm no tech guy. I didn't want to speak too soon.
  25. Alright. If there's no blatant problems with it I'm good with it.
×
×
  • Create New...