Jump to content

havenphillip

Members
  • Content Count

    297
  • Joined

  • Last visited

Community Reputation

89 Excellent

1 Follower

About havenphillip

  • Rank
    Advanced Member

Profile Information

  • Gender
    Male

Recent Profile Visitors

1,092 profile views
  1. Social media certainly descends into a dumpster fire very naturally. Zuckerberg's idea of bringing the world closer together looks more now like just throwing a bunch of angry animals in a cage together and expecting them to get along. It's like prison dynamics with with escalation and reciprocal escalation based on absurd or arbitrary in-group/out-group distinctions.
  2. 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
  3. 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.
  4. I see. So trying to get collision out of a shader is pretty much an exercise in futility.
  5. 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?
  6. 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:
  7. 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.
  8. 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; }
  9. 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.
  10. Alright. If there's no blatant problems with it I'm good with it.
  11. 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.
  12. Yeah this should be everything involved. bloom.zip
  13. Yeah I agree. I give Josh the benefit of the doubt, though. There's only so much one guy can do. If the demand for it was high enough I'm sure he'd put that in. There has to be a solution out there somewhere. We just got to find it ourselves.
  14. That's weird. I never noticed that. This is probably way beyond me. I don't know the terrain shaders at all. I think casting shadows has to do with materials, and you can't put materials on the terrain.
  15. Yeah that's the problem. But I seem to have gotten around it by loading the shader outside the Start() function. I thought a script would be good, otherwise for every entity you use it on in a single scene you'd need to make a whole new shader if you wanted to adjust any of the settings. 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 = 1.0 -- float "Brightness" Script.specIntensity = 1.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.0 -- float "Texture Size" Script.shader = Shader:Load("Parallax/parallax_economy.shader") -- here instead of in the Start() --Script.shader = Shader:Load("Parallax/parallax.shader") -- here instead of in the Start() function Script:Start() mat = Material:Create() 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) self.entity:SetMaterial(mat) end function Script:Release() self.shader:Release() mat:Release() end
×
×
  • Create New...