Advertisement Jump to content
Sign in to follow this  
GroZZleR

HLSL Question - Random numbers?

This topic is 4911 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!