rainbow generator

Community Forums/Showcase/rainbow generator

RemiD(Posted 2016) [#1]
Hello, :)

Just playing with Blitz3d to see if i could reproduce a rainbow in 3d with a mesh (made of several arcs) and vertices colors :

with a grey sky :


with a blue sky :


animated gif :
rd-stuff.fr/rainbow-generator-(greysky)-500w312h-10fps.gif

source code here : http://www.blitzbasic.com/codearcs/codearcs.php?code=3288


Rick Nasher(Posted 2016) [#2]
Nice piece of code. But appears the blue sky filters out the other colors.
I did a quick experiment and changed the '3' to '1' as you suggested in below line which gives a brighter colored result - at least on my system.
EntityBlend(Rainbow_Mesh,1)  ;1 or 3

Now let's add some clouds, sun, rain hills, trees a few rabbits and we're in Teletubby land ;-)


Rick Nasher(Posted 2016) [#3]
Btw: I couldn't locate the pot of gold at the end of the raibow..


RemiD(Posted 2016) [#4]
Yes it looks better with a grey/white sky.

With a whiter sky it is better to use blendmode alpha (1) instead of blendmode add (3)



Btw: I couldn't locate the pot of gold at the end of the raibow..


take a look at that :
en.wikipedia.org/wiki/Rainbow#Full-circle_rainbow
it may help : ;)


Rick Nasher(Posted 2016) [#5]
Ah that explains it all. :-) Or.. perhaps the leprechaun can only be found when in Ireland?



Blitzplotter(Posted 2016) [#6]
nice work, to be sure ;)


RemiD(Posted 2016) [#7]
More for fun than for a real need ;)


I bet it could look even nicer with a glow effect on it...


Hardcoal(Posted 2016) [#8]
Fun is a need :)
And sometimes best things comes from the need for fun :p
Plus, who doesn't like rainbows..
Ask Noah


Bobysait(Posted 2016) [#9]
Nice looking.
Perhaps you could/should skip vertexcolor (for once ^_^) and use a texture instead (a single row texture like 8*1 pixels)

And by the way, the arc equation is pretty simple to implement, you'll save yourself a lot of time by just using cos/sin instead of all this pivot stuff


(a small sample of using a texture -> it also use alpha on the texture to fade the borders)


The mesh is composed of a single "line" of triangle (a triangle strip), so you can get higher details with lower triangles. (just notice that below 25 for RainbowSeg, you'll start to see the segment)


RemiD(Posted 2016) [#10]
@Bobysait>>yes i could have used another approach to create the arcs but i do what i can with what i know :P


Nice example too. :)


RemiD(Posted 2016) [#11]
It is weird how that even with the same alpha, the same blendmode, the same background color, the result does not seem to look the same...


RemiD(Posted 2016) [#12]
Forget about what i said (in post#11), using the same alpha, the same blendmode, the same background color, the results look similar :



Hardcoal(Posted 2016) [#13]
..


AdamStrange(Posted 2016) [#14]
@RemiD The second image (the one on the right) has a very nice 'smooth' look to it, plus the nice fade towards the bottom.

the other one has a blocky feel - you can see the geometry underneath it. - looks like 9 segments on the left?

Me preference would be the one on the right as it has a professional look to it. The blocky one feels a bit cheap in comparison...


RemiD(Posted 2016) [#15]
The one at right is the example by Bobysait
The one at left is my example

However you can add more sections to have a more round shape, no worry, just edit the code !


I find interesting how it is possible to achieve a similar result using only a mesh and vertices colors, or with a mesh and texels colors (a texture)


RemiD(Posted 2016) [#16]
less blocky more roundy version for Adam :


and you can also understand how it is made with the wire view.