Jump to content

havenphillip

Members
  • Content Count

    301
  • Joined

  • Last visited

Community Reputation

98 Excellent

1 Follower

About havenphillip

  • Rank
    Advanced Member

Profile Information

  • Gender
    Male

Recent Profile Visitors

1,219 profile views
  1. 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.
  2. That looks cool, man. I like how you're just instinctively creating puzzles and effects.
  3. 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?
  4. 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
  5. 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
  6. 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.
  7. I see. So trying to get collision out of a shader is pretty much an exercise in futility.
  8. 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?
  9. 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:
  10. 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.
  11. 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; }
  12. 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.
  13. Alright. If there's no blatant problems with it I'm good with it.
  14. So what does that mean? It's slower that way? I see some places in the community you're talking about the map hook but I haven't even touched C++ yet. I can't really make sense of it. I don't know what it would look like in Lua. If you know a better way in general to help me improve this then by all means explain it, fix it, optimize it, whatever. I still consider myself a noob and I really don't know a lot of things still.
  15. Yeah this should be everything involved. bloom.zip
×
×
  • Create New...