Sign in to follow this  
Endemoniada

Precomputed Procedural Texture ?

Recommended Posts

Endemoniada    430

Hi guys,

 

Can I take the position (xyz) being shaded and use it to look up a colour in a 2D texture or cube map ? Instead of calculating a colour using a procedural texture function I'd like to use precreated textures.

 

I know I can implement Perlin noise in a pixel shader but that's not what I'm after.

 

I've read about cube maps but haven't seen anything about direct texturing, only about sky boxes and reflections. I don't know if using a 2D texture for this is even possible, let alone how to do it.

 

Some help would be great. Thanks.

 

Share this post


Link to post
Share on other sites
SeanMiddleditch    17565

This is quite possible and very frequently seen in graphics.  This is commonly referred to as a "look up texture" (LUT) when used as an intermediary in calculations.

 

You can use all kinds of parameters besides position as your texture coordinates, too, such as other intermediary values.  There are no rules about what the coordinates used in a texture access are supposed to represent.  They could be normalized angles or intensity values or noise input or whatever you need.

 

Whether you need a 2D texture, a 3D texture, or a cube map is not something anyone could say without you telling us what you're actually trying to do. :)

Share this post


Link to post
Share on other sites
C0lumbo    4411

Sounds to me that you're after a 3D texture. A cube map consists of the 6 faces of a cube, it's hollow - there's nothing inside it. A 3D texture is the name for what you're after, a solid cube (or cuboid) of texture.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this