newaged Posted February 12, 2016 Share Posted February 12, 2016 This resource changes the shading on most objects, making them look like this http://i.imgur.com/slbN28E.png.Changes:shaders\common\lighting\advanced\vectorLightP.hlsl, line 203 float dotNL = dot(-lightDirection, normal); to float dotNL = clamp(smoothstep(0.4, 0.43, dot(-lightDirection, normal)), 0.2, 1.0); shaders\common\lighting\advanced\pointLightP.hlsl, line 163 float nDotL = dot( lightVec, normal ); to float nDotL = clamp(smoothstep(0.4, 0.43, dot( lightVec, normal )), 0.2, 1.0); shaders\common\lighting\advanced\spotLightP.hlsl, line 99 float nDotL = dot( normal, -lightToPxlVec ); to float nDotL = clamp(smoothstep(0.4, 0.43, dot( normal, -lightToPxlVec )), 0.2, 1.0); A more difficult to install version that includes object outlines is currently in progress.http://i.imgur.com/fjN6ebA.png Quote Link to comment Share on other sites More sharing options...
Janders Posted February 22, 2016 Share Posted February 22, 2016 Looking good! Are there options in the editor, or it works only on code?Can't wait for the outlines! Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted February 23, 2016 Share Posted February 23, 2016 Here's an old outline shader, incase it helps.http://yorkshirerifles.com/random/outline_shader.zip ;) Quote Link to comment Share on other sites More sharing options...
doc Posted February 25, 2016 Share Posted February 25, 2016 Nice! Thank you!Going to tweak my light attenutation in 3..2..1.. Quote Link to comment Share on other sites More sharing options...
TorqueFan Posted July 15, 2016 Share Posted July 15, 2016 Anyone get this working in any of the newer T3D builds under DX11? The shader code is a bit different now. Quote Link to comment Share on other sites More sharing options...
TorqueFan Posted July 16, 2016 Share Posted July 16, 2016 Ah, nevermind. The one-line change is still relevant - I just didn't search well enough for it the last time! :oops: Quote Link to comment Share on other sites More sharing options...
Timmy Posted July 16, 2016 Share Posted July 16, 2016 For the most part, changes in the hlsl shaders you need are (glsl remain the same)Texture Sampling: // Old Code uniform sampler2D textureMap : register(S0); float4 color = tex2D(textureMap,uv); //New code TORQUE_UNIFORM_SAMPLER2D(textureMap,0); float4 color = TORQUE_TEX2D( textureMap, uv); Pixel Shader targets: //Old code COLORn //New code TORQUE_TARGETn Semantics (vertex shader output and pixel shader input only. Vertex shader input remains the same as does all other semantic names) //Old code POSITION //New code TORQUE_POSITION There are a few other things so just ask if you have troubles with any shader conversions. Quote Link to comment Share on other sites More sharing options...
TorqueFan Posted July 20, 2016 Share Posted July 20, 2016 @Timmy - Nice, thanks. Will be converting a class I based off of ScatterSky soon, and if I run into trouble I'll post about it. The class did pass some new shader values around. Quote Link to comment Share on other sites More sharing options...
Timmy Posted July 21, 2016 Share Posted July 21, 2016 Also just beware when using custom shaders, with DX11 it is very, very fussy that the vertex format matches exactly the same as the shader.E.GBad (AppData in the vertex shader doesn't match vertex format): //C++ GFXVertexBufferHandle<GFXVertexPCT> verts; // Vertex Shader struct Appdata { float3 position : POSITION; float4 color : COLOR; }; Bad(order is incorrect in the vert shader: //C++ GFXVertexBufferHandle<GFXVertexPCT> verts; //Vertex Shader struct Appdata { float3 position : POSITION; float2 texCoord : TEXCOORD0; float4 color : COLOR; }; Good: //C++ GFXVertexBufferHandle<GFXVertexPCT> verts; //Vertex Shader struct Appdata { float3 position : POSITION; float4 color : COLOR; float2 texCoord : TEXCOORD0; }; Quote 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.