The MASM Forum

Toddler's Corner => Romper Room => Topic started by: caballero on September 18, 2017, 12:03:00 AM

Title: Sphere Flake with raytracing
Post by: caballero on September 18, 2017, 12:03:00 AM
I'm just working on this subject. The app run slowly for now, so just the image.
Title: Re: Sphere Flake with raytracing
Post by: caballero on September 18, 2017, 12:12:50 AM
The same with a level of depth more
Title: Re: Sphere Flake with raytracing
Post by: hutch-- on September 18, 2017, 12:59:02 AM
caballero

Just don't fill the place with a large collection of images, they take up a lot of server space over time.
Title: Re: Sphere Flake with raytracing
Post by: caballero on September 18, 2017, 01:05:31 AM
Ok, you may remove them when you want :t
Title: Re: Sphere Flake with raytracing
Post by: caballero on November 03, 2017, 12:50:56 AM
Hello. This is a basic stage, so everything works in the first plane, no extra threads of execution. Thus, if you use some heavy behaviours like "a-antialiasing" or "d-depth of field" it can take a long to complete and the program won't respond until finished. Each key you use activates one behaviour, this key again deactivates it.

Each behaviour activated and every extra level of the sphere flake involve more time consuming. Nevertheless with one light it could be rasonably fast.

I would suggest use the "4" key to reach the fourth level of the sphere flake and hit twice the "L" to turn on three lights (maybe it is best viewed with three lights that with only one), maybe then "r" for reflects.

These are the keys what you can interact with the program:
- a/A. Antialiasing
- d/D. Depth of field
- r/R. Reflection
- l/L. Increase the number of lights (max=3)
- k/K. Decrease the number of lights (min=1)
- 1,2,3,4. The level of iterations for the sphere flake
Title: Re: Sphere Flake with raytracing
Post by: felipe on November 03, 2017, 03:11:56 AM
Didn't work to well in my computer.  :icon_exclaim:

 :t
Title: Re: Sphere Flake with raytracing
Post by: caballero on November 03, 2017, 03:32:21 AM
Ops, what has happened?
Title: Re: Sphere Flake with raytracing
Post by: mabdelouahab on November 03, 2017, 06:16:53 AM
Didn't work to well in my computer.  :icon_exclaim:
The same happened to me
Title: Re: Sphere Flake with raytracing
Post by: felipe on November 03, 2017, 11:40:37 AM
It hangs and windows has to terminate the program.
Title: Re: Sphere Flake with raytracing
Post by: HSE on November 04, 2017, 12:06:05 PM
Hi Alfonso!

The image look very well. Perhaps some problem in the loop of events (keys).

r/R is duplicated for diferent thing in your explanation.
Title: Re: Sphere Flake with raytracing
Post by: caballero on November 04, 2017, 08:40:42 PM
Hi Horacio. k/K for decrease the number of lights (the second r). It works fine in my W7 and WXP. Maybe the problem is because all the execution is in first plane, don't use threads. Some works takes a long and it is needed to wait a bit.

Thank you for report it:t
Title: Re: Sphere Flake with raytracing
Post by: HSE on November 05, 2017, 02:40:08 AM
 :t
An idea is: put the name of the process ("increasing ligths", etc) in the title bar and remove when completed. We aren't very good waiting.
Title: Re: Sphere Flake with raytracing
Post by: caballero on November 05, 2017, 04:05:38 AM
Well, this is what a basic stage is for. Each behaviour activated means more time consuming (for example "a" activates antialiasing, "a" again deactivates it). With one light and no other adding is reasonably fast. Each level in the sphere flake add many more spheres which involves more calculations to find the impacts of the light rays with them. Maybe it is best viewed with three focus of light (three "L"). It is specially slow the use of "a-antialiasing" or "d-depth of field". Each time you choose an option everything is built again, what could be surely improved.

Thank you :t
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 18, 2017, 06:51:41 AM
Keep on learning this subject, achieved three kind of spheres: opaque, glass and metal. Uniform and checkered texture. Plain c (not c++).



PD: very tiny jpg
Title: Re: Sphere Flake with raytracing
Post by: HSE on December 18, 2017, 11:15:21 AM
Glass have some problem, it's opaque for the opaque.  :t
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 26, 2017, 05:17:27 AM
Another texture for spheres: Perlin's marble
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 29, 2017, 03:52:26 AM
One step more. A bitmap file mapped on an sphere. In the pic, the Perlin marble and the world map and a few small balls.

What the f**k, this deserves a tune (https://www.youtube.com/watch?v=nFuCBaHhjZI).
Title: Re: Sphere Flake with raytracing
Post by: HSE on December 29, 2017, 04:56:05 AM
Better this (https://www.youtube.com/watch?v=CRd1sXmTcA0) to show your images  :t 
 (note the play between the camera and Asja Kadric)
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 29, 2017, 05:04:30 AM
That's a very good music. One of the Epic Music as you said. I like it a lot. :t
Title: Re: Sphere Flake with raytracing
Post by: Siekmanski on December 29, 2017, 06:59:45 AM
Hi caballero,

Awesome results.  8)
Have you looked into ray marching? It's faster than ray tracing.
Ray marching is a specific algorithm, a variant on ray casting where samples are taken down a line to test for intersections or other criteria.
This is easier to implement and allows for speed optimizations via number of samples.
I'm studying pixel shaders at the moment and have the basic code running now.
This is really cool stuff.
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 29, 2017, 07:11:34 AM
I didn't know anything about ray marching, I will have a look to it as soon as I can. I am a heavy block that has difficulty moving :biggrin:, I need to go little by little. My intention was to learn as much as possible of ray tracing and then get it to move fluently to make some demo.

Yes, shaders coding are really cool, I have seen some awesome demos with that. I'm waiting for your news :t.
Title: Re: Sphere Flake with raytracing
Post by: Siekmanski on December 29, 2017, 07:30:28 AM
I'm new to this topic and have much to learn.
There are some great ray marching examples to learn from on https://www.shadertoy.com/
And there are some tutorials on youtube too.
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 29, 2017, 07:46:41 AM
Related to shaders, ray tracing, etc, this is (http://www.iquilezles.org/) a recurrent page, by Íñigo Quilez
Title: Re: Sphere Flake with raytracing
Post by: Siekmanski on December 29, 2017, 07:56:07 AM
Íñigo Quílez is one of the best Demo programmers in the world, Shadertoy is build by him too.
His nick name is IQ.
This is his contribution at Breakpoint 2009 and the winning 4k intro.

https://www.youtube.com/watch?v=_YWMGuh15nE
Title: Re: Sphere Flake with raytracing
Post by: caballero on December 29, 2017, 08:11:23 AM
Impressive what fit in just 4kb, if I'm not wrong, the sound is produced also by the code
Title: Re: Sphere Flake with raytracing
Post by: Siekmanski on December 29, 2017, 08:21:51 AM
Impressive what fit in just 4kb, if I'm not wrong, the sound is produced also by the code

Yeah, it's all in those 4kb
They use a "linker-cruncher" named crinkler to compress the code. www.crinkler.net
Title: Re: Sphere Flake with raytracing
Post by: caballero on January 02, 2018, 12:01:32 AM
Penumbra and two kind of light sources. Maybe a bit imprecise yet.
Title: Re: Sphere Flake with raytracing
Post by: caballero on January 02, 2018, 03:04:27 AM
Evidentelly, increasing the number of rays, increases the definition of the image. But I wonder if this is the desirable technique or rather to ensure that the rays do not overlap, which in itself would require more cycle. Or perhaps the use of a random number generation function more prone to generate different numbers.
 :eusa_boohoo:Valerie (https://www.youtube.com/watch?v=xoArZLquHGo)
Title: Re: Sphere Flake with raytracing
Post by: HSE on January 02, 2018, 04:49:10 AM
Perhaps worth the price seconfd option  :t

Trying to escape from the 80's you sended: https://www.youtube.com/watch?v=VJboSby7nW0 (https://www.youtube.com/watch?v=VJboSby7nW0)
Title: Re: Sphere Flake with raytracing
Post by: caballero on January 02, 2018, 05:22:28 AM
Nice video :t. You have some musical instruments with which you expect a certain type of sound, wonderful by the way, but from which you can extract another completely different, unexpected and also great, right? Which reminds me of this scene (https://www.youtube.com/watch?v=QlPhAf7q9jc) from the movie "top secret" :biggrin:
Title: Re: Sphere Flake with raytracing
Post by: HSE on January 02, 2018, 05:46:39 AM
 :biggrin:
Title: Re: Sphere Flake with raytracing
Post by: caballero on January 08, 2018, 01:53:55 AM
Same scenary with camera movement
(http://abreojosensamblador.net/Imags/Productos/Raytrace028.gif)