PDA

View Full Version : 2 Octave 3D Noise Vertex Shader Demo



pocketmoon
06-07-2002, 02:55 PM
For Nvidia owners:
http://www.pocketmoon.com/3dnoise.zip

Based on Nvidia's vnoise demo, I've squeezed two octaves of 3D noise into an 118 instruction Vertex Shader (noise.vp)

It's animated (moves through noise space in the y direction) and you can select different objects by using the keys 1,2,3...

I like the BLOB (object 1). It reminds me of a recurring nightmare I used to have when I was ill as a child!!!


Let me know if it works for you.

Cheers

Rob J.

Nutty
06-07-2002, 03:15 PM
Yeah it works, but theres probably more efficient ways of creating the same effect. What can you do with it, that really makes use of the power needed to compute that?

Nutty

pocketmoon
06-07-2002, 09:52 PM
you surprise me nutty! It interests me to do it.

Also lets just say I wanted to do better than the Nvidia guy who wrote the original http://www.opengl.org/discussion_boards/ubb/wink.gif

Rob

Zeno
06-08-2002, 12:11 AM
Wow, that is really cool http://www.opengl.org/discussion_boards/ubb/smile.gif Thanks for posting it.

-- Zeno

Nutty
06-08-2002, 02:01 AM
I'm not knocking it, nice to see ppl try and improve stuff. Just we know it's quite expensive to compute, and was wondering what you'd actually use it for?

WhatEver
06-08-2002, 05:13 AM
When I make it animate, a black ball moves slowly away from me and then when it's real small it starts to do its thing...which looks like a blob thats trying to give birth to something.

I have a GeForce2

[This message has been edited by WhatEver (edited 06-08-2002).]

pocketmoon
06-08-2002, 06:42 AM
WhatEver - there's a bug in the original code when you turn animation on!

It should be auto-animated anyway.
You can move the viewpoint around and zoom in/out with the mouse and combinations of ctrl/shift ...

Nutty - It's proved a very valuable excersise! My heavily optimised C Perlin Noise code, which I use in the Procedural Planet (and other) demo's, now appears bloated compared to my 50 instruction Vertex Shader code. I shall now be re-visiting my C code soon! Anyway, who's to say that at the end of the day my procedural planet has more GPU free than CPU and therefore can spare a few shaders to get a nice ocean http://www.opengl.org/discussion_boards/ubb/smile.gif

simongreen
06-10-2002, 03:34 AM
Yeah, I admit it, Rob - you're a better vertex shader coder than me! If you were calculating the normals as well, then maybe I'd be impressed http://www.opengl.org/discussion_boards/ubb/smile.gif

And if you guys think vertex shader Perlin noise is pointless, you should see some of the stuff they *don't* let me release!

Sound synthesis or data encryption vertex shaders, anyone?



Originally posted by pocketmoon:

Also lets just say I wanted to do better than the Nvidia guy who wrote the original http://www.opengl.org/discussion_boards/ubb/wink.gif

Rob

pocketmoon
06-10-2002, 05:32 AM
Simon! Excellent, your first Post http://www.opengl.org/discussion_boards/ubb/smile.gif

I was hoping you'd read the post and respond - it's always great to get the pro's involved here.


Originally posted by simongreen:
Yeah, I admit it, Rob - you're a better vertex shader coder than me! If you were calculating the normals as well, then maybe I'd be impressed http://www.opengl.org/discussion_boards/ubb/smile.gif

I put it down to age and experience. My first experience of hardware rendering was dragging a screwdriver across the board of a TRS-80 and watching the screen corrupt... though I'm sure you'd easily win a vertex shader shootout.

Oh and I'll have the normals in there by wednesday http://www.opengl.org/discussion_boards/ubb/smile.gif

Maybe Nvidia should have a Obfuscated Vertex Shader contest!

davepermen
06-10-2002, 09:31 AM
Originally posted by pocketmoon:
Maybe Nvidia should have a Obfuscated Vertex Shader contest!

that again lets me think about how well the extensions of nvidia are designed. its quite easy to get obfuscated code without doing anything bad, not important if registercombiners or vertexshaders.. /methinks the ext-design is not THAT well done http://www.opengl.org/discussion_boards/ubb/wink.gif

don't look at my registercombinerssetup for perpixelbumpmappedselfshadowedinclfakedspecularlig htinginonepass (with only 2 general combiners, i have a gf2 only..). THAT is obfuscated http://www.opengl.org/discussion_boards/ubb/wink.gif

pocketmoon
06-12-2002, 01:46 AM
Originally posted by simongreen:
If you were calculating the normals as well, then maybe I'd be impressed http://www.opengl.org/discussion_boards/ubb/smile.gif


Ok It's wednesday http://www.opengl.org/discussion_boards/ubb/smile.gif

I have two octaves of 3D pseudo perlin noise with the normals derived from the weighted sum of the surface normals of both octaves together with a final diffuse lighting calc all in 127 instructions.

I'm calculating the noise surface normal by doing two more sets of lattice value interpolation (for each octave), one offset by a small x amount, the other by a small y amount (K.A. Forward Differencing ?)

In effect caculating:
X = noise(x+dx, y, z)
Z = noise(x,y,z+dz)

and normalising the vector
(X,1,Z) to get the apprix surface normal.

By interpolating between Y/Y+1 first you only have to repeat the last two stages of the interpolations (X/X+1 & Z/Z+1) and you can do both dx and dz calculations at the same time by some fiendish swizzling!

All I have to do is test it when I get home!

VP Source and a demo later if it works. A grivelling retraction later if it doesn't.

ta ta

Rob J.

pocketmoon
06-14-2002, 07:05 AM
http://www.pocketmoon.com/3dnoise.zip

As promised http://www.opengl.org/discussion_boards/ubb/smile.gif

davepermen
06-14-2002, 07:51 AM
you can submit this to nvidia. as far as i know they haven't yet implemented the noise function for cg.. but i would suggest you to write an optimized one-octave one.. as else you would fill up the power of a gf3/4 with just one instruction in the cg http://www.opengl.org/discussion_boards/ubb/wink.gif

knackered
07-16-2002, 12:43 AM
I saw this, and thought of you, pocketmoon: http://www.flipcode.com/cgi-bin/msg.cgi?showThread=07-15-2002&forum=iotd&id=-1

pocketmoon
07-16-2002, 06:45 AM
cheers, knackered, i'll check it out.

I laughed when Cg was launched - I'd like to see someone try and get Cg to compile an equivalent shader down to 128 instructions http://www.opengl.org/discussion_boards/ubb/smile.gif