More bitmap-producers

ZGE Source Code discussion. Ask questions, present your changes, propose patches etc.

Moderator: Moderators

User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Well experiments often fail,. np with that,. is how we learn new things.

hummm, some more ideas;

- convert to polar coordinates,. usefull for reflection maps in shaders, as well as generating visual effects,.

- import/rasterize SVG takes a SVG (scalable vector graphic) file as input and has some setting to generate a raster/bitmap,. small SVG files could be used to generate complex smooth large bitmaps. GUI elements, bimap cheracters, texture elements,. etc. [ http://www.inkscape.org/ ]

- just load up the GIMP and look through the filters see what would be usefull in texture asset generations and interesing to code. most any of that would be usefull in designing bitmaps proceduraly.

- the SVG idea reminds me,. it would be cool to use also for mesh gen! as basic as text curves to 3d text,. not just for text but as bases for modeling procedurally as well,. .

and btw, scripts/libraries are as usefull as new components and only included when specificaly needed, so any contribution there is just as valuable.
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

noise module finalized

Post by kattle87 »

Ok guys: here it is: the brand new shiny bitmap noise component.
Features:
are the same explained for this:
http://infohost.nmt.edu/~imcgarve/perlin_noise/
Octaves (Starting Octave and # of octaves values): Starting octave is the equivalent of zoom.
Offset: unique component :P. this is a offset for the base colour: you can choose if the base for the colour should be 0.5 (gray) or black/white. This offset is not just a sum, I tried to also make the colours "more vivid" when you put the offset near zero (and near one, too). If you need straight sum, leave offset at 0.5 and DIY by a Zexpression :)
Persistance: see link
Random seed: this is a float value. Why? Because you can change that in time to get an animated noise, and using a float value is needed in order to get a smooth transition.
Colour: right now I wanted to avoid an option to making a different noise for every channel. We can discuss this feature, but IMHO is not this important. Mainly because this would mean making the component 3 times slower, and the same can easily be accomplisced by Zexpressions and combinations of nioises. For this reason, the colour works like the one in the pixels component.
Tile: self-explanatory. Straight tiling was not possible/produced artifacts, so this uses a generic way to make the noise tile. Bad thing is that this requires to compute noise 4 times, making it somewhat slower.
Before it goes in mainstream, we can still discuss something. Patch was sent to Ville.
Attachments
Difference between tiling and not tiling noise :)
Difference between tiling and not tiling noise :)
NoiseProducer2.jpg (135.2 KiB) Viewed 20000 times
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

This looks promising Kattle. It'll take a few days before I take a more detailed look at this and build a new beta, so please be patient :)
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I've tried this out now. It looks good and is easy to use. Also quite fast.

I notice this in your code:

//The "+4096" is just a hack to be sure that the X and Y are
//always > 1.

Why is it important to make the coords > 1? Is it because the noise-function is discontinuous around zero? I think we can fix that in the noise function instead.

Alternatively the 4096 can be added outside the loop like this:

X := I/(W-1) + 4096;

This should make the code faster and smaller.

And I consider changing the property name "RandomSeed" to "ZStep" since it only affects the Z-coordinate, do you agree?
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Yep, the noise function was discontinuous for negative numbers, we discovered this a while ago, maybe you forgot about this...
I didn't bothered getting this to work, I just didn't realized that it was a fix needed anyway on the noise function! I can surely look into this when I'm getting back to Milan.

EDIT: just checked the differences between our implementation and a reference implementation in C++: they use a floor function. We got a floor function too :P Ville, you can try doing the following: use "floor" instead of "trunc", then try to open the test file I attached.

Anyway, if I remember correctly, doing something similar of what you proposed broke the code and resulted in something awful. Right now, if the "floor function" fix fails, I would avoid changing that value and I would just go with this to let JPH play some ;)
The name ZStep sounds as confusing as a floating Random Seed IMO, maybe ZHeight, ZAltitude, ZValue or ZPan might be more accurate. I think that "ZStep" sounds just too much... discrete for my tastes. :P
Attachments
noisetest.zgeproj
(483 Bytes) Downloaded 789 times
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Yeah, I was doing exactly the same thing and noticed about the floor-function. Then I changed the code and remembered the reason why I didn't use the floor-function in the first place: it makes the noise function 30% slower. But then I found a improved floor-function on the Fastcode-project so performance is up again and your code works without having to make the coordinates positive, so it's a win!

ZHeight sounds good, I'll try that :)
Post Reply