More bitmap-producers

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

Moderator: Moderators

User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

More bitmap-producers

Post by VilleK »

Now when Francesco has made the cell-component and blur-improvements what else do we need to make cool looking tiling textures?

I can think of two that are obvious:

BitmapNoise (tilable)
BitmapPixels (for single pixels that in combination with blur-component gives interesting shapes)

Any more ideas? And Francesco are you working on these components yourself or do you want me to do something?
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Yes with the tiling Cells and the new Blur features things are indeed shaping up,. I agree that tilable noise is an important addition,. even if it is a simple blend at the edges,. hay, perhaps we could just add a make tileable component,. you know like those gimp/photoshop filters.., takes one input and makes it tile?

for the pixels I had come up with a workable ZExpression seems to tile fine;

Code: Select all

 float seed=8;
 if ( noise3(x*88,y*88,seed) >.2 ) this.pixel=rnd(); else this.pixel=0; 
you can get a 'density' type setting from the >.2 value. It ranges from like .001 to .28 due to the noise .3 values,. but a component could be sweet,.

I was also messing with the SuperForm script and found I could rotate the shapes so I added a loop to do compound supers!

Code: Select all

float R, T, Xp, Yp, N1, N2, N3, M, Tp, S, Z, posX, posY;
M=2; N1=4; N2=7; N3=7; S=-1; Z=5;

for (int i=0; i<3; i++) {
posX=.495+cos(i*.333*pi*2)*.2;
posY=.495+sin(i*.333*pi*2)*.2;

Xp=(this.Y-posY)*Z; Yp=(this.X-posX)*Z;
T=atan2(Yp,Xp)+(i*.333*pi*2); R=sqrt(Xp*Xp + Yp*Yp);
Tp=R-pow(pow(abs(cos(M*T/4)/1),N2)+pow(abs(sin(M*T/4)/1),N3),-1/N1);
 if (Tp<0) {
 this.Pixel.a+=Tp*S;
 this.Pixel.r+=Tp*S;
 this.Pixel.g+=Tp*S;
 this.Pixel.b+=Tp*S;
 }
 
}
not realy tileable always but can be,. that could be embeted in a component for kids what dont want to mess with the scripting too much,. (perhaps this could be tweeked into an MC Escher type tileing shape thing by fliping alternating shapes??! such as; http://www.mindspring.com/~mc.escher/es ... cher61.jpg or http://www.leninimports.com/mc_escher_sculpture_2.jpg )

also one thing I would find very usefull is a tiling Distortion component,. it takes two inputs, like the combine, (so perhaps to save size, it's just a combine method!,. any more creative ones of those would be happy happy too!) and it warps (offsets) the pixels of input A by the value of input B,. not sure what you do with color values, I am thinking of just a grayscale for input B, but many variant could be devised,. not sure how to make that tileable either,. .
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Idea about the code of distort component is ready :P But I'm at holiday away from my PC so you will have to wait a little.
I'm thinking about a "light" component too, probably ready within 2 weeks xD
Will get a grayscale component as an hightmap and then use a variable to set the intensity/direction of the light.

For what concerning tileable noise: the easy way is to get the "pixel" function then blur it amplifying a little. I say this is the way since the perlin noise will never be tileable :D (by definition :P)
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
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

We know tileable noise is do-able as other non free apps have it,. however some messing about with that bit of pixel code and some levels of your tileing blur (with the very usefull amp!) does give some very satisfying results :)

also for more tile research, here are some links of interest;
http://www.gamedev.net/community/forums ... _id=480446
http://www.gamedev.net/community/forums ... _id=439778

the second one got me to here;
http://libnoise.sourceforge.net/index.html
some nice stuff with pages of explenations,. and compact codes.
Attachments
this tiles now!
this tiles now!
tile_noise.jpg (30.74 KiB) Viewed 32411 times
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Ok Pixels and distort components are on their way. I will get them working soon (not tried yet :/). If the tileable noise will just be the blurred "pixels" component, will everybody be fine with that? (I mean no new component, just combine them!)
On Saturday I will have a 5 hours long trip on a train... It should be enough for the 2 components. I might have also found a "speedup" for the blur (with no need for making the code bigger...)
However, I am finding some problems with the light component (still while developing the idea). What I came up with:
-Fast and precise algorithm... Drawbacks: only one-direction light (EG: from up to down or from left to right)
-A bit slower (unconfirmed) but surely less-precise algorithm, based on normals like the one from TG. This will be capable of any kind of light (EG: Spot light included)

Now we have to take a decision, or post some ideas :D
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
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

While that dots to noise technique is useable and welcome, I still think a proper tiling noise component is a noble pursuit of the highest order,. (w/ octave, frequency, Persistence, etc.) however, so are the other rather usefull components you are talking about,. so do what you like! :D as Ville was saying earlier we each have some idea that motivates us for a while, and I have also found it is (sometimes?!?) fruitfull to pursue what the muse is offering,. . some times not :(
as far as the light,. would it not work the same if we just rotate the image befor casting the light from top or bottom? Guess the results of each approach will vary as well,. spot vs direction as well,. . like I always say whatever you can hack into this reality we will endevor to utilise,. ;)

Don't forget to look out the window on the train, that is my favorite part of travel, the views. enjoy!
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

yes, but there's a problem with the rotation: the created image will not tile. Let me explain better: if you get an image and rotate it, you will loose some corners of the image. Now, if you get the image and rotate it back, it will not tile. This is a bad situation, you know! You can avoid this by zooming out before rotating, then zoom in again after the light component have finished working... but I don't love this since zoom out means lowering the quality, and we don't know really well how much we can loose before the final user gets upset :D

BTW: an update to the cell component is ready :P Won't say nothing about it yet, I want to create some hype :D
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=-
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

some code is almost ready (only going to check it out again) so I will send today to Ville. Updates include:
-Added a "passes" variable to the blur component. It is equivalent to chain several different blur components. Values allowed from 1 to 4.
-Pixels component: creates white, red, green or blue pixels. Properties are: Seed, NOfPoints (actually this is not the count since it will be multiplied!) and Colour.
-New property for the Cells component: metrics used (JPH do you remember that taxi distance stuff?) :P
-Distort component. It takes the second input as green/blue map for points displacement. It has a % multiplier (integers allowed from 0 to 100) to make the distortion stronger if needed. The image i'm showing is wrong since it takes the first as displacement, now that was changed.

I really hope you will enjoy this.
Attachments
Cells with &amp;quot;Product&amp;quot; metric
Cells with &quot;Product&quot; metric
cells.jpg (9.79 KiB) Viewed 32344 times
Green and blue pixels (lots of them!) blurred with a single pass 8-10 radius and amp.
Green and blue pixels (lots of them!) blurred with a single pass 8-10 radius and amp.
pixels.jpg (12.67 KiB) Viewed 32344 times
Final result applying the distortion =)
Final result applying the distortion =)
final.jpg (22.46 KiB) Viewed 32344 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
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

ohh,. that does look like some fun!
I very much look forward to the next beta, as I still have not setup to build,. but a may soon, as I have had some ideas for the sound synth section,. I want to start experimenting with that,. and eventually I would like to re-build the sound engine as a node setup like the bitmap one,. you know; add an oscillator or 3, then a filter or two, an envilope, LFO,. etc,. and design the synth system needed for the specific game,. just a wild idea currently,. but could be fun/educational to try,. . inspiered by this current flood of cool bitmap work and this other program; http://chuck.cs.princeton.edu/doc/program/ugen.html
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I've merged your latest changes Francesco. I made some minor modifications for optimization and clarification, I hope I did not break anything :)

I've only tested it quickly but it seems to work great.

I suggest we change the BitmapDistort property "Multiplier" to "Amount" and make it a float-variable with 0.0 - 1.0 range. Both because it is the amount of distortion and also because it makes the horizontal slider visible making realtime preview easier.
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

I'm fine with the modifications. Nothing should be broken, at all ;)
It's ok for me if you use the float number ranging from 0 to 1... I've never looked into the editor to see if one could set some kind of bounds right there (this is very important or the code will *crash* with values minor than -1 or higher than 1) however you are the main developer, you decide :P

BTW: sadly, I think I won't be able to contribute more code before the end of the month... So for me we can go for a release.
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
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Horizontal slider good! when ever you can provide one please, please do.., realtime tweeking=fast finding of usefull values,. would be very nice for this 'distort amount'. and wow! it works great,. making some very cool effects possible,. the new additions to the cells component are awesome!!
After I'm done playing around making abstract paterns out of them I will get down to creating some usefull textures for an environment,. thinking of trying a full 3d walking around type thing,. soon.

also just wundering why the cells=> 'point count' is limited to 30 ? perhaps we could try letting it go higher 48, 64 ? I realise it will be slow but as long as we don't try realtime updating of it, it could prove usefull.

Thanks a bunch for all this, I am using them already!
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

well... I thought 30 points were enought for everyone :P but as you already made it clear to me, we should always work in generic ways since we don't know what a user will came up with... :)
So now you ask for a new limit =) is 48 fine? I'm picking up a limit since I fear that some user could set a 3-numbers-digit and almost crash the editor. Maybe 64 is still reasonable. Ville what's your opinion? :)
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 »

Beta updated again today :)

Increased cell points to 64
Distort property is now called "Amount" (type zptScalar force the value between 0 and 1)

I like the GetIncrement-procedure you added Francesco. It made much of the code smaller and cleaner. I updated it to take advantage of the fact that W and H always are power of two values so bit manipulation can assure X and Y are in valid range. That made it even smaller and faster.
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Nice idea resorting to bit-checking to get sure that values are in the correct range! ^^ I'm missing a little of low-level optimizations sometimes... You know I might have made something similar but I would have needed 10+ hours of debugging :P
Plus I wanted to ask you if we can resort to global variables in order to avoid the needing of writing down the H and W parameters when calling the function... I don't know how much code we would save and I know that globals are commonly considered bad programming practices... But what about that?
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=-
Post Reply