Jump to content

Parallax shader


havenphillip
 Share

Recommended Posts

Maybe a better explanationrepetitions.thumb.jpg.e434c4b50194fdbe2b6c33a275bc91a5.jpg: 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.

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 months later...

Here's a terrain model with a pixel depth offset shader with trails. I managed to figure out how to keep it from looking like things are slipping over the parallaxed surface so now you can put stuff on it. It's a little temperamental still. It doesn't like horizontal intersecting (shifts a bit. Not sure how to fix that) and  the effect deteriorates with distance (which I think I can fix). But I figured out that you can get this thing quite a bit faster by shrinking all the textures except the diffuse since the parallax effect and diffuse do most of the work on realism, and I got it working on smoothed lumpy surfaces such as hills, etc. You can make your own trail pattern with a texture and use whatever trail diffuse you want and adjust the size and blend and other things. I added a bunch of variables to the shader to fiddle with so you can highly customize it or just mess with it.

Notes:
Put the included material on the terrain model (6 textures. The texture order is rocky soil diffuse, rocky soil normal, rocky soil smooth, rocky soil height, trails, hardpack diffuse, hardpack normal).
Disable "Cast Shadows" on the material.
Make sure the model has physics. I use poly mesh.
Put the model in the scene and set the scale to 12*12*12 (temperamental. This is the size for the model the shader is set to work with)
Put stuff on it so you can see the pixel offset effect.



 

pdo.jpg

parallax_pixel_depth_offset.zip

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...