[effect] Mario Cube FX

Share your Construct 2 effect files

Post » Thu Mar 16, 2017 4:56 pm

@matriax

Yes , the first demo is based on IQ rasterized traingles. It use 1 itération to draw the result;

https://www.shadertoy.com/view/XdlGzn

You can now roll x,y for make building like your demo on twitter;
http://gigatron3k.free.fr/html5/C2/FX/mcube
If camera is upper of the object you must use roll x,y ;
If camera is face of the object then you can use rotation x,y etc...


fx file :
http://gigatron3k.free.fr/html5/C2/FX/mcube.rar
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Thu Mar 16, 2017 5:57 pm

@Gigatron Perfomance tests comparing Rasterize-RayMarching

Number of sprites at 256x before frame downs
Raymarching = 150
Rasterize = 320

Number of sprites at 512x before frame downs
Raymarching = 60
Rasterize = 120

Number of sprites at 1024x before frame downs
Raymarching = 25-30
Rasterize = 60

Mmm... this is correct? I thought with rasterize the perfomance will be boosted, yes there is obviously an improvement but i was expecting more than 1000 cubes for 256x :S . But at the end the perfomance was "only" 2x.

I'm going to see the .FX code and do other test to see if i can find in this case what is the thing more GPU is taken.
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Thu Mar 16, 2017 6:09 pm

@matriax
Don't forget this : every sprite you created mean X sprite on the execution with C2. Each Sprite are used to draw glsl shader inside;

Are you tryed performance with empty square sprites on C2 without fx ?

Hope you understand .
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Thu Mar 16, 2017 6:19 pm

@gigatron Nope, tried now, i did it and this are the results:

Number of sprites before frame downs
512x512 = +1900 sprites(no FX) | 120 With Rasterize FX Cube
1024x1024 = 800-900 Sprites(no FX) | 60 With Rasterize FX Cube

What you think?

Also i saw the .FX code and damn, how complicated is do a simple cube with a texture :S .
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Thu Mar 16, 2017 6:38 pm

@matriax
glsl texture3D ... or textureCube is missing in glmatrix 1.30 used by C2 ; maybe C3
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Thu Mar 16, 2017 6:45 pm

can you add function to remove light effect? i dont really need it :( , but the whole effect is really awesome!
B
8
S
2
G
1
Posts: 17
Reputation: 1,034

Post » Thu Mar 16, 2017 6:57 pm

Follder22 wrote:can you add function to remove light effect? i dont really need it :( , but the whole effect is really awesome!


Sure ; Brdf Removed now , (Bidirectional Reflectance Distribution Function ).

the fx based on triangles :
http://gigatron3k.free.fr/html5/C2/FX/mcube.rar
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Fri Mar 31, 2017 7:26 am

@Gigatron Since C3 is still in beta, no SDK plugins,etc... and seems until June/July no will be released the "final" version and i had an idea to optimize it maybe if works i will give another try to do some mini game.

First of all i tested the Roll.X and Rolly.Y and gives a wrong perspective, the base of the model change their position and looks some weird streched. There is no way to really move the camera pos? (X,Y,Z) .


About the idea to optimize the shader

I edited the values of the rasterize method in .FX and got the cube no draw some faces and the perfomance was improved even if that faces are not visible.

If i'm right, there is no way, rotating a cube that you can see more than 3 faces true?.

So, if you can add some math or check the cube to no render the faces that are not visible, depending how optimized is that code in theory we can have aprox 3x perfomance from the actual results?

What you think?

Edited: And even more perfomance because depending the perspective of the game you only will see 2 faces of the cube because the two in back and the one in the floor and in the top no will be visible for example in a Wolf3D.
B
23
S
10
G
3
Posts: 538
Reputation: 4,426

Post » Fri Mar 31, 2017 7:57 am

@matriax

You can add uniform flag like up,down,left,right,back,front after that check those values by 0== off or 1.0== on;

example from 2.5d plarformer cube;
Code: Select all
 
if(face_left_right==1.0)  mate = texture2D( samplerFront, uv ).xyz * abs(wnor.x);
   
   if(face_up_down==1.0)     mate = texture2D( samplerFront, uv ).xyz * abs(wnor.y);//+
                                 //  texture2D( samplerFront, uv ).xyz * abs(wnor.y);
   
   if(zz_face==1.0)          mate = texture2D( samplerFront, uv ).xyz * abs(wnor.z);
                           
   if(all_face==1.0)         mate = texture2D( samplerFront, uv ).xyz * abs(wnor.x)+
                              texture2D( samplerFront, uv ).xyz * abs(wnor.y)+
                             texture2D( samplerFront, uv ).xyz * abs(wnor.z);   
    }   


In the mario cube case you can ignore face with adding colors in place of texture;

Code: Select all
if (mc == asn.x) {
        return mix(texture2D( samplerFront, uv*vec2(0.25,0.33)-vec2(-0.25,-0.335) ).xyz, vec3(0.,0.,0.), ln.x)*brdf;
    }
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

Post » Fri Mar 31, 2017 8:22 am

@matriax
Sorry but no time here i am working to finish trailblazer;
If you need help i can collapse each face to on/off but next week ;

Regards
http://gigatron3k.free.fr/Intro/

https://www.shadertoy.com/user/gigatron

https://twitter.com/realistquantum

Ezekiel 1-4 ; ufo landing explanation ..

CONSTRUCT 2 THE ONLY FAST WAY TO HTML5

Image
B
57
S
20
G
29
Posts: 804
Reputation: 21,969

PreviousNext

Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests