• Create Account

# jariRG

Member Since 22 Apr 2006
Offline Last Active Today, 08:20 AM

### In Topic: Generating a sine-based tiled procedural bump map

15 May 2015 - 05:02 AM

You are not limited to [0..2PI] range to pass to the sine function. It is a cyclic function, so whatever you pass to it, your output from it will be in the [-1...1] range, always.

### In Topic: Generating a sine-based tiled procedural bump map

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).

### In Topic: Generating a sine-based tiled procedural bump map

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.

### In Topic: Generating a sine-based tiled procedural bump map

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).

### In Topic: Per-pixel displacement mapping GLSL

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)?

PARTNERS