YouGroove Posted April 5, 2014 Share Posted April 5, 2014 Shader idea for later : Something great for non realistic games : Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted April 5, 2014 Share Posted April 5, 2014 Not tested but give it a shot : in vertex shader add : out vec3 eye; Find : vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position,1.0); After add : eye = normalize( modelvertexposition.xyz - cameraposition ); In fragment shader : Add : in vec3 eye; after all normal calculations add : //calculate rim float NormalToCam = 1.0 - abs(dot(eye*cameranormalmatrix,normal)); float rim = smoothstep(0.0, 1.0, NormalToCam); //adjust here for rim thickness Find : fragData0 = ... After add : fragData0+=vec4(rim,rim,rim,0); 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
gamecreator Posted April 5, 2014 Share Posted April 5, 2014 Ha, Spelunky - great game Quote Link to comment Share on other sites More sharing options...
YouGroove Posted April 6, 2014 Author Share Posted April 6, 2014 I tried but it failed. In fact it's modifying diffuse shader ? Will that work with animated diffuse shader ? after all normal calculations add : Where it is ? seems last lines in fragment ? Find : fragData0 = ... After add : fragData0+=vec4(rim,rim,rim,0); The problem is this is before normal map calculation. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted April 6, 2014 Share Posted April 6, 2014 In a simple diffuse shader without normalmapping, normal calculation is just a passthrough from the vertexshader like this : vec3 normal = ex_normal; so after that then 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
YouGroove Posted April 6, 2014 Author Share Posted April 6, 2014 I changed camera variable as it didn't existed, but even like that it don't compile ? rim.zip Quote Stop toying and make games Link to comment Share on other sites More sharing options...
shadmar Posted April 6, 2014 Share Posted April 6, 2014 Ah just add this under uniforms in the fragshader. uniform mat3 cameranormalmatrix; There I go for writing shaders from a tablet.. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
YouGroove Posted April 6, 2014 Author Share Posted April 6, 2014 Thanks it worked : I put Rim shader file here , could be part of LE3 official shader package rim.zip Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.