Sign in to follow this  

[Resolved][MDX]Realtime noise in HLSL

This topic is 4299 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, does anyone know where I can find an article or a sample of realtime noise? I'm trying to make something like the background of the main menu in Midnight Club II. Thanks. :) [Edited by - CadeF on March 6, 2006 2:20:49 AM]

Share this post


Link to post
Share on other sites
You could try interpolating between two pregenerated noise textures in HLSL. Just generate two textures with random noise and lerp between those over time in a pixel shader. I'm using this for my cloud rendering and it seems to work out just fine for that.

I tried googling for "midnight club menu", but there seem to be entirely to much midnight dinners out there, so I don't know if this technique is of use to you ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by remigius
I tried googling for "midnight club menu", but there seem to be entirely to much midnight dinners out there, so I don't know if this technique is of use to you ;)
Your googling powers are weak young jedi [lol]

Midnight Club II Screenshots, including this one that might be the menu:



Although, I can't see any noise in that image though [oh]

Anyway, regarding the original question...

I've seen some tricks similar to what remigius described - sample from multiple different noise textures using different resolutions and animated offsets. I'm not sure, but you could probably compute some sort of simple noise in a lengthy VShader and interpolate it using the pixel shader (possibly mixing in some "static" noise from a texture)...

hth
Jack

Share this post


Link to post
Share on other sites
Nice suggestion, I've tried it before. It looks too... "repeatish".

The best I can describe it, is as a warping plasma field sorta thing. Jollyjeffers, that is it, but its too small to see and I dont think its visible when the menu is up, its visible when you start the game before navigating the menu.

VB6 Perlin Noise
Something like this would be nice. Note, there is an exe in the zip if you dont have VB6.

Share this post


Link to post
Share on other sites
Quote:
Your googling powers are weak young jedi


Thanks, Obi Jack Jolly [wink]


Quote:
Nice suggestion, I've tried it before. It looks too... "repeatish"

Well, for my clouds I actually use 3 textures. Two textures are used by the shader at any given point for the interpolation, giving me about 2 seconds to fill the 3rd one with some new noise. Once the interpolation is finished, I swap the textures and interpolate again... Like this:


1) [1] -- Int(0.5) --> [2], [3] being filled

2) [1] -- Int(1.0) --> [2], [1] is unused so swap and put in texture [3]

3) [2] -- Int(0.0) --> [3], [1] starts being filled

4) and so on...

Using the typical perlin noise octaves (3 will do) will further enhance the visuals.

Alternativly, you could implement a Perlin noise function in HLSL. I've been thinking about that too, but never got around to doing it since the approach above worked fine for me. Nevertheless, this article describes a noise function that seems simple enough (details in article near "Making your noise functions"):


function IntNoise(32-bit integer: x)

x = (x<<13) ^ x;
return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);

end IntNoise function


Whatever you decide to do, the look of plasma will probably also benefit from decent interpolation techniques and the exponentional cut-off which is commonly used for clouds. The article describes these thorougly, so it proved a must-read for noise stuff for me [smile]

Share this post


Link to post
Share on other sites
The noise in the article, will it animate smoothly? To animate perlin noise, for example, you increase the z sample.

Edit: After looking into perlin noise in hlsl, I found I need to make a permutation texture and a gradient texture. The code to make them is a function, in the format
func (tc : TEXCOORD0) : COLOR0
{
return somecolor;
}
As they are procedural textures. In MDX, how would I use create a texture like this?

Share this post


Link to post
Share on other sites
Got it working, using turbulence with perlin noise. It won't fit under PS 2.0, but it does under PS 2.a so I'll leave it at that.

Share this post


Link to post
Share on other sites

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

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