Day 17: Basic noise

Categories AShaderEveryDay

        Today I decided to set aside the ray marching engine to focus on GLSL’s basic like procedural  texture generation witch will be very unseful for the sphere tracing later 🙂 . To make this noise the formula is simple ;  you compute the sinus (sin(x)) of a dot of two 2D vectors , then you took the fractional part (fract(x)in GLSL) of the result. To resume is look like this :

float random (vec2 st) {
    return fract(sin(dot(st.xy,vec2(13.4,74.0)))*(83983.0));
}


First noise… 🙂

Day 15 : First texture

Categories AShaderEveryDay

Finally I had not enough time to start voxel’s learning, I will do that this weekend. So I started an approach of texturing.. 🙂 Update tonight !


First  procedural texture test
(click on  play to start animation )

Day 14: Playing with booleans

Categories AShaderEveryDay

Nothing really new, tonight I only had time to play a little some Boolean operations. Tomorrow, I will try to implement a simple texel based ground or make my first texture. 🙂

Rotation function test on cam and object.
(click on  play to start animation )

Day 11 : Rotation

Categories AShaderEveryDay

        Tonight I added a basic rotation function and tested it on the current scene. Tomorrow I will try to generate the base object of the Menger Sponge.


Rotation function test on cam and object.
(click on  play to start animation )

Day 10 : AO and Rewriting

Categories AShaderEveryDay

        Tonight, AO added and lighting function rewrote using struct to improve readability and flexibility. I also test multiple lights with colors 🙂


Light epreriment + basic AO
(click on the shader box title to see the code )

Day 9 : Lighting upgrade

Categories AShaderEveryDay

     Tonight, I added the most common lighting model in  video game based which is: Color = Emissive + Ambient + Diffuse + Specular. This article is the best resource I found to describe it. Now that the rendered output is correct, I will try to clean and optimize it.


Lighting major upgrade
(click on the shader box title to see the code )

Day 8 : More shadows

Categories AShaderEveryDay

        Today, I followed Inigo Quilez‘s explanations about soft shadows then add them. Finally, I also add a fog attenuation which is given by  exp(-pos * k) where pos is actual pixel position and k a coefficient to adjust the fog strength.


Shadow upgrade
(click on the shader box title to see the code )