• Create Account

#ActualHodgman

Posted 14 January 2013 - 05:44 AM

I worked on a project with digital (I hope he doesn't mind me giving away the technique) where he came up with a neat trick that I like to call "texture-space parallax".

Say you've got a 3D model of a bunch of grass blades (please excuse my mspaint art):

If you tiled it in the world and rendered it, the camera rays would look something like below, but your triangle-count would be huge:

So instead, in this technique you just pick the direction that the camera is looking in (or some other arbitrary choice of direction that looks good), and render a single "tile" of grass to a texture, using an orthographic projection in that direction.

e.g. when looking down/right, or down/left, your ortho renderings would look like this (colours on the line at the top are the resulting 2d "grass" texture from the 3d model):

You then just use that 2D texture as usual on your ground, but as the camera rotates, the parallax effect of the grass blades changes.

This is incorrect, because as you can see, the rays in our ortho view are all parallel, where in the reference image above, the rays all diverge and cause different parallax in the foreground than in the background... but it's ridiculously cheap and worked well enough for us at the time.

When rendering the ortho view, we also rendered height data into the alpha channel, so that we had the option of doing extra effects later when using the texture, like parallax mapping, or outputting modified depth values so that the grass would seem to rise out of the ground and clip with player's feet, or modified lighting based on height, etc...

You've also got to take a lot of care when creating your 3D grass model so that the resulting 2D texture tiles correctly -- e.g. if a bit of grass is near the edge of the "tile", then you've got to duplicate it and move it over, just outside the opposite edge.

This isn't the best example, but here's a flat plane that's been textured with this technique -- http://i.imgur.com/6WEHC.png -- obviously only useful for quite short grass, not fields of wheat, etc

#3Hodgman

Posted 14 January 2013 - 05:43 AM

I worked on a project with digital (I hope he doesn't mind me giving away the technique) where he came up with a neat trick that I like to call "texture-space parallax".

Say you've got a 3D model of a bunch of grass blades (please excuse my mspaint art):

If you tiled it in the world and rendered it, the camera rays would look something like below, but your triangle-count would be huge:

So instead, in this technique you just pick the direction that the camera is looking in (or some other arbitrary choice of direction that looks good), and render a single "tile" of grass to a texture, using an orthographic projection in that direction.

e.g. when looking down/right, or down/left, your ortho renderings would look like this (colours on the line at the top are the resulting 2d "grass" texture from the 3d model):

You then just use that 2D texture as usual on your ground, but as the camera rotates, the parallax effect of the grass blades changes.

This is incorrect, because as you can see, the rays in our ortho view are all parallel, where in the reference image above, the rays all diverge and cause different parallax in the foreground than in the background... but it's ridiculously cheap and worked well enough for us at the time.

When rendering the ortho view, we also rendered height data into the alpha channel, so that we had the option of doing extra effects later when using the texture, like parallax mapping, or outputting modified depth values so that the grass would seem to rise out of the ground and clip with player's feet, or modified lighting based on height, etc...

You've also got to take a lot of care when creating your 3D grass model so that the resulting 2D texture tiles correctly -- e.g. if a bit of grass is near the edge of the "tile", then you've got to duplicate it and move it over, just outside the opposite edge.

This isn't the best example, but here's a flat plane that's been textured with this technique: http://i.imgur.com/6WEHC.png

#2Hodgman

Posted 14 January 2013 - 05:35 AM

I worked on a project with digital (I hope he doesn't mind me giving away the technique) where he came up with a neat trick that I like to call "texture-space parallax".

Say you've got a 3D model of a bunch of grass blades (please excuse my mspaint art):

If you tiled it in the world and rendered it, the camera rays would look something like below, but your triangle-count would be huge:

So instead, in this technique you just pick the direction that the camera is looking in (or some other arbitrary choice of direction that looks good), and render a single "tile" of grass to a texture, using an orthographic projection in that direction.

e.g. when looking down/right, or down/left, your ortho renderings would look like this (colours on the line at the top are the resulting 2d "grass" texture from the 3d model):

You then just use that 2D texture as usual on your ground, but as the camera rotates, the parallax effect of the grass blades changes.

This is incorrect, because as you can see, the rays in our ortho view are all parallel, where in the reference image above, the rays all diverge and cause different parallax in the foreground than in the background... but it's ridiculously cheap and worked well enough for us at the time.

When rendering the ortho view, we also rendered height data into the alpha channel, so that we had the option of doing extra effects later when using the texture, like parallax mapping, or outputting modified depth values so that the grass would seem to rise out of the ground and clip with player's feet, or modified lighting based on height, etc...

You've also got to take a lot of care when creating your 3D grass model so that the resulting 2D texture tiles correctly -- e.g. if a bit of grass is near the edge of the "tile", then you've got to duplicate it and move it over, just outside the opposite edge.

#1Hodgman

Posted 14 January 2013 - 05:32 AM

I worked on a project with digital (I hope he doesn't mind me giving away the technique) where he came up with a neat trick that I like to call "texture-space parallax".

Say you've got a 3D model of a bunch of grass blades (please excuse my mspaint art):

If you tiled it in the world and rendered it, the camera rays would look something like below, but your triangle-count would be huge:

So instead, in this technique you just pick the direction that the camera is looking in (or some other arbitrary choice of direction that looks good), and render a single "tile" of grass to a texture, using an orthographic projection in that direction.

e.g. when looking down/right, or down/left, your ortho renderings would look like this (colours on the line at the top are the resulting 2d "grass" texture from the 3d model):

You then just use that 2D texture as usual on your ground, but as the camera rotates, the parallax effect of the grass blades changes.

This is incorrect, because as you can see, the rays in our ortho view are all parallel, where in the reference image above, the rays all diverge and cause different parallax in the foreground than in the background... but it's ridiculously cheap and worked well enough for us at the time.

When rendering the ortho view, we also rendered height data into the alpha channel, so that we had the option of doing extra effects later when using the texture, like parallax mapping, our outputting modified depth values so that the grass would seem to rise out of the ground and clip with player's feet, or modified lighting based on height, etc...

You've also got to take a lot of care when creating your 3D grass model so that the resulting 2D texture tiles correctly ;)

PARTNERS