Jump to content
  • Advertisement
Sign in to follow this  
GroZZleR

HLSL Question - Random numbers?

This topic is 4840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, Just a quickie here: Is it possible to generate a random number inside a shader? I can't seem to find any intrinsic function to do this and I obviously can't set an outside value because that'll set it for the entire pass and not on a per vertex / pixel value. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:

I obviously can't set an outside value because that'll set it for the entire pass and not on a per vertex / pixel value.

You could (obviously :-) sent an array of outside values.

Furthermore, a small RNG is not so hard to write so might as well include one in your HLSL file.

Greetz,

Illco

Share this post


Link to post
Share on other sites
You could also use a texture with random values if this is for a pixelshader or VS3.0 and up.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!