Jump to content

havenphillip

Members
  • Posts

    550
  • Joined

  • Last visited

Everything posted by havenphillip

  1. This is: if ((int(gl_FragCoord.x + gl_FragCoord.y) % 4) != 1) discard; ...with the lighting quality up.
  2. Ok yeah that looks great on shadows if I turn up the lighting quality in the options. Seems like that would be the best use. I cranked everything up on the normal shader but it still looks all dithered. 2 looks pretty good, though, even with the lighting on low:
  3. Has a little more of a dithered look: if ((int(gl_FragCoord.x + gl_FragCoord.y) % 4) == 1) discard;
  4. Dude that's rad. I just tried it on a basic shader and got semi-transparency in-game. It's not z-sorted or anything.
  5. Looks good to me. What do you feel like is lacking in it?
  6. I mean initially you said the engine would be super fast. After all the things you've added is it what you had anticipated?
  7. How is the engine speed after adding all that lighting and shadows?
  8. Ok maybe I'll start with that. I want to get into modeling but I tried Blender once before and it felt like a very steep learning curve. I need it easier and faster. I bought 3DCoat but barely opened it for the same reason. I don't know if it's any good. But the walls of that ship look awesome that's what I want to make. And I like that 4-texture PBR idea, and the steam coming out of the wall that's so Alien.
  9. @ evil turtle That looks awesome what program do you use to make models?
  10. Leadwerks can do that. You want to make sure your hay texture is a png rather than a jpg because apparently jpgs don't carry alpha information. The "discard" technique in the diffuse + alpha shader is what creates that hard alpha falloff. I think I understand what you're saying and if so then you might also try opening the hay material and setting the blend mode to alpha and checking the Z-sort box (then save). My usual move is to do this then replace the "discard" line with a mix and a mask. But you can see a smooth alpha blend in the picture below (though actually I did use a mask on that one). That may work for what I think you're trying to do (but you'll notice it eliminates the shadowing, which can then be replaced with a Blinn-Phong. I can help you out with it if you want). Also (shameless self-promotion) I put up a bunch of shaders on my blog. There's some swaying trees and masks and blending etc. Maybe you'll find some principles there for some of these kind of shader problems.
  11. I use this thing: https://www.pragmar.com/qbit/ Then I put them all in GIMP and use this this template to line them up.
  12. havenphillip

    Extras 2

    Here's some more extra shaders. I had a lot of fun with these. Some playing with normals. Some post-effects. Some experimental stuff. Just a mixed batch of noob adventures. This first shader is pretty simple and is a nice noob move to add more detail to any scene. You start with the base shader and simply mix it with another normal texture. You can easily see the effect it produces and this is useful if you want to add small details to a material - like for instance making skin or rocks (below) more porous, or if you want to show the threads in a cloth, etc. It's a cool little effect to have in the repertoire and it only requires an extra texture and two extra lines of code in the normals section: //Normal vec3 normal = ex_normal; normal = normalize(texture(texture1,ex_texcoords0).xyz * 2.0 - 1.0); vec3 normal_detail = normalize(texture(texture4,ex_texcoords0 * normal_detail_size).xyz * 2.0 - 1.0); <-- here normal = mix(normal,normal_detail + normal, normal_detail_mix); <-- here normal = ex_tangent * normal.x + ex_binormal * normal.y + ex_normal * normal.z; normal = normalize(normal); 00a_normal detail.zip This is a variation of the normals from heightmap shader (37_normals from heightmap) and I included it because I'm getting some better results with it than the other one. Set the heightmap to uncompressed in the texture editor for best results. You can see the normal dot3 map created in Leadwerks from the diffuse gives a nice normal map but it's not very bumpy. The "super bump" shader yields way more dramatic (and rounded) results, but you lose a bit of the sharp details that you would get from something like the Leadwerks normal because you are basing the normals on the heightmap. You can adjust the resolution to get varying results with 1000 being sharp but not very rounded normals. The picture below has the resolution set to about 300. The technique from the normal detail shader above is included so that you can still use the regular normal map to add details to the normals or double down on the normals in order to get some of those little details back. The difference here is instead of using two normal maps you're using one normal map and one (adjustable) heightmap. I love this thing. It really adds a lot of drama to your materials: 37b_super bump.zip I thought a shader collection ought to have an anisotropic specular and this was a pain to get working. You can see in the code it just looks like a tangled blinn-phong mess but it looks cool and can be used to give that anisotropic look to hair (below) or brushed metal. 48b anisotropic specular.zip This next shader does a texture scroll on a normal texture and then adds the xy of that texture to the texture coordinates of the diffuse: ...water_normal = normalize(texture(texture6,water_texsize * tex - vec2(0,time * speed)).xyz * 2.0 - 1.0); ...vec4 wet_diffuse = texture(texture0, tex + (water_normal.xy * 0.1)); ...fragData0 = mix(outcolor,wet_diffuse,mask); This produces sort of a wobbling pseudo-refraction effect in the diffuse by slightly shifting the texcoords of the diffuse according to that scrolling normal, which gives the effect of water running down the face of a surface. Add a cubemap for reflections and a mask and you get this effect: 22a_weeper.zip Here is a high-pass filter shader I made from the kernels blur shader. The high-pass filter is easy to create in Photoshop or GIMP. Essentially what you're doing with a high-pass filter is using a blur to sharpen an image. The idea is that you take the diffuse texture and blend it with a blurred and inverted version of itself. When you do that, you get just a grey image, but the blurring slightly offsets one of the textures and the difference created really dramatically draws out the little details in the image. I included a post-effect version of this here and I believe that would be the correct use of it, as seen below: 01d_high pass filter.zip This is my attempt at creating a waterfall. I thought the tessellation shader would be a solid direction to go in and it did turn out pretty good. The trick was to get the diffuse texture scrolling with itself. Once I got something that looked pretty decent I copied and pasted that outcolor section into the evaluation stage as the displacement so that the lighter colors would jut out more than the darker colors - so there is a consistency in color and displacement. The material is z-sorted to get the alpha fade and as a result I lost the specular. So I used a blinn-phong to get a light source and then scrolled the normals so that I could get those little "sparkles" which is consistent with water effects. Ultimately all the scrolling speeds and texture sizing are pretty arbitrary. I was just trying to make chaos that looked cool and gave me the impression of falling water. My modeling skills are not that great and I get the feeling this shader could look much cooler with a better model, but the effect is there. One thing to note is that when I made the model I uv-mapped the mask to it so that it would fit regardless of the size or how I might stretch the Y scale on the model to make it taller or shorter, and the mask fades to black (alpha) near the bottom. On taller waterfalls this gives the impression that the water is dissipating into mist: 41b_waterfall.zip This last one is just a fun experiment I was messing with. There are techniques for turning a diffuse image into an albedo image in Photoshop or GiMP using the Luminance/Luminosity blend mode. The reason you would do that is because you don't want shadow information in your diffuse texture. You want only color and you want the shadows and highlights work to be done by the lighting, object shape, and normals. The idea behind this shader is that you take the diffuse texture twice (one being the blend and one being the base) and blend these by the luminance so that the color of the blend blends according to the luminosity of the base (or was it the other way around???). This shader simulates that technique (There's a video link I included at the top of the shader that explains it better). You can adjust the contrast and saturation, and I included a post-effect version of it so you can "albedoize" everything all at once - and I have no idea if that's something that should actually be done but it was fun for me (You could maybe treat it as a tone map or something). You can see it colors in the dark areas and sort of flattens out the contrast. I set the diffuse and height textures to uncompressed and it looks pretty good: 53_albedoize.zip
  13. I updated and re-uploaded the above shader. I tried it on the tracks and was getting a bad result. It looks right now. Before and after:
  14. Yeah you totally can. It's just a matter of changing the alpha value of the diffuse texture in the diffuse + normal decal shader. Try this shader on your decal material: decal alpha + normal.zip I changed only three lines: //Alpha fragData0.a = 0.0; //was probably 1.0 fragData1.a = 1.0; //was fragData0.a; ... was set to the alpha of the diffuse so when you set diffuse alpha to zero it also set normal alpha to zero fragData2 = vec4(vec3(0),1.0); //the alpha channel was fragData0.a I also normalized the ex_tangent, ex_binormal, and ex_normal. Here I just tried it with the bulletmark decal material. Only the normals show up. No diffuse: Also I have the material set like this (not sure how much "pick mode" or "z-sort" matter):
  15. Here's the model version: -- create box and attach painter model material to it -- create camera in scene and attach spectator script to it so you can fly around -- create pivot and child it to camera, and attach this script to it painter model.zip
  16. Ok so I was able to make this simple painter using a Shadertoy shader. Just put a pivot in a new scene and attach the script to it. The problem I have is when I try to switch the shader over to a model shader, and I change the line in the shader from: if(length((coord*buffersize) - mouse_pos.xy) > radius) discard; ...to this: if(length(ex_vertexposition.xy - cameraposition.xy) > radius) discard; ...and change these updateworld lines also in the script to this: function Script:UpdateWorld() mouse = self.entity:GetPosition(true) self.shader:SetVec3("cameraposition", mouse) end ...I end up with a dot that follows the camera around but it stops leaving trails. I don't understand what I'm losing in the process. Why is that happening? painter.zip
  17. That's cool. What script idea did you go with in the end?
  18. Yeah the buffer is just a target to render to. All it's doing is double-buffering the scene. In the updateworld function you can see it's toggling between the two, and what occurs on the screen is bound to the buffer using Bind(). I think those were the important parts. I messed with this CCTV script from here at one point http://leadwerks.wikidot.com/start - which is kind of similar - but it never went anywhere. If I recall correctly the trouble I had was figuring out how to use the CCTV in the PostRender function.
  19. There's one if you look up "HUD Elements" in the Workshop that I got from Macklebee. You could probably chop that one up and make it work for you. The minimap script creates a bounding sphere around the player and looks for the KeyValue "enemy." So you have to add SetKeyValue to "enemy" in your target script. I think I included a crawler script that has that added in the Start function.
  20. That looks pretty cool. Can you make them smaller, though? Can you manipulate the size and shape at all? This takes some pressure off me I wasn't getting anywhere. I need to try the buffer thing.
  21. bro I opened Leadwerks today the decals aren't working all of a sudden and there's no motor sound. Any idea what happened? Edit: nvm I had messed with the decal shader I fixed it.
  22. Ok awesome. Thanks. I got it working. Now what I need to do is find a way to set the height in the shader as the decals in the script.
  23. Ok I tried downloading a few cars and scripts. I cant get it working it's getting too complicated. Would it be easy for you to write a single track script in the 3rd person player script so that the player leaves one trail behind? I just need something simple. I think you understand this decal thing better.
  24. "There is a last option they could have used in the video..maybe it is possible to create a surface with mud material and move it, as you want using the vertex coordinates. With this method it was easy to recreate little waves like water could do, so it could be possible to move a surface as mud would do?" Yeah that's pretty much the idea. But I need to move the vertex according to the trails that are left in the wake of the tires. So the trails from the tires act as the heightmap. Getting the trails to "stay on the ground" is the trouble. If I can get that I can work out the rest of it. You posted a partial script for your trails recently: I think I would need that whole script - or some simplified version of it. From there I think I could work out a shader. I don't think it's the "proper" way, though, but it might work. I also don't know if I could get that working on terrain. On a model more likely. From what I understand the correct way to do it is to create a buffer and somehow mix the buffer and the color texture together so that the renderer saves the created trail path.
  25. The decals thing might work but you'd have to loan me the script. If so it would just be a matter of connecting the decals to a tesselation shader and figuring out some kind of tesselation lod. It would look cooler if it was drawing in height rather than on the diffuse, and it's possible you could randomize a few textures to get that mud up on the sides of the tires if a sprite sheet doesn't work. The veggies moving shader only records a small area around the player. It doesn't remember where the player has been - so no trails still. But if I could get trails that one could be useful, especially for improving that particular shader.
×
×
  • Create New...