• Create Account

# jariRG

Member Since 22 Apr 2006
Offline Last Active Today, 04:49 AM

### #5229002Generating a sine-based tiled procedural bump map

Posted by on 14 May 2015 - 12:10 PM

Generate the random points on the whole image range (0..WIDTH, 0..HEIGHT), because the first term under the square root is a simple distance calculation (current x,y coord to the Nth random point). That's why the "true" random points not work here => poor distribution of points (and rand generates new point position for every pixel, and every N step, this caused the noisy image).

### #5228939Generating a sine-based tiled procedural bump map

Posted by on 14 May 2015 - 05:41 AM

The output of the sine function is in the range [-1..1], so taking N times the sine (summing up) gives the result range [-N...N]. (In your example N is 100, so if the sine function returns 100 times -1, it adds up -100). After finishing the summation you divide the result by N, so you get the result [-1...1], but the color range is [0...1], that's why you need to rescale the value before write it as pixel.

And if you look at the sine function: from 0 to PI the sine is positive, after PI it goes to negative (and came up positive again after 2PI). It is not all positive in the 0..2PI range, as you said.

### #5228910Generating a sine-based tiled procedural bump map

Posted by on 14 May 2015 - 01:00 AM

Krypt0n is right, these numbers should not be random, but some kind of distributed points on the image. For example, simple grid points. (take every Xth pixel on each axis)

For the third "random", try a small fix value first (like 0.0005), then tweak it.

And if i'am right (it is morning ), you should rescale your result after you divide by N. (sinf range is [-1...1], so the result can add up to [-100 ... 100], depending on the input parameter).

### #5151157Per-pixel displacement mapping GLSL

Posted by on 03 May 2014 - 04:59 AM

I am not sure, but dont you have to normalize normalObject and tangentObject (vertex normal and tangent after the matrix multiplication)?

### #5145114Eliminating OpenGL/DirectX differences

Posted by on 07 April 2014 - 12:10 PM

http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/perspective-projections-in-lh-and-rh-systems-r3598

### #5008483drawing in Win32

Posted by on 08 December 2012 - 07:16 AM

CreateDIBSection with BitBlt/StretchDIBits/SetDIBitsToDevice is the fastest method as i know. Here: http://sol.gfxile.net/wintut/ch3.html you can find a great tutorial for it.

### #48231692D texture missing a triangle

Posted by on 14 June 2011 - 05:47 AM

Thanks, it worked. I figured something like this would happen because I've never tried my hand at texture mapping before. Simple error thankfully.

Does the direction of the circle matter?

It does when backface culling is enabled (glEnable(GL_CULL_FACE), but by default it is disabled).

PARTNERS