OK,
Cosmo pointed out that my shader folder was likely the culprit, and reverting it made the Jag work... nice.
However, now have cars that used Stereo's dyn_standard_alpha_reflect_f.cg shader not working anymore, because that is a shader that was made somehow to work and now it isn't when I put it back in my shaders_hdr folder.
Can anyone tell me why this doesn't work?
//
// Standard with reflection cubemap
//
#include "atmosphere.cg"
#include "lighting.cg"
#include "fresnel.cg"
// Vertex to pixel shader structure
struct v2p
{
float extinction : COLOR;
float2 tc0 : TEXCOORD0;
float3 Direction : TEXCOORD1;
float4 RayleighColor : TEXCOORD2;
float4 MieColor : TEXCOORD3;
float3 Position : TEXCOORD4; // For fragment shader
float3 normal : TEXCOORD5;
// Fresnel in pixel shader
float3 I : TEXCOORD6;
//float fresnel : TEXCOORD6;
float3 R : TEXCOORD7; // Reflection vector
};
void main(
// In
in v2p IN,
// Out
out float4 outColor : COLOR,
// Constants
uniform sampler2D baseMap : TEXUNIT0,
uniform samplerCUBE envMap : TEXUNIT1,
uniform float3 lightDirection,
uniform float3 lightColor,
uniform float3 lightAmbient,
uniform float3 eyePosW,
uniform float atmosRayleigh,
uniform float atmosMie,
uniform float3 Ke,
uniform float3 Ka,
uniform float3 Kd,
uniform float3 Ks,
uniform float Kr,
uniform float3 shininess,
uniform float exposure
)
{
float3 skyColor;
float3 N=normalize(IN.normal);
// Get sky gradient color
skyColor.rgb=GetSkyColor(lightDirection,IN.Direction,IN.RayleighColor,IN.MieColor,atmosRayleigh,atmosMie,lightColor);
// Get base texture color
float4 baseCol=tex2D(baseMap,IN.tc0);
// Reflection
//const float Kr=0.5f;
float4 envColor=texCUBE(envMap,IN.R);
// Lighting
float3 ambient,diffuse,specular;
LightingSun(Ke,Ka,Kd,Ks,shininess,lightDirection,lightColor,lightAmbient,IN.Position,N,eyePosW,
ambient,diffuse,specular);
baseCol.rgb=baseCol*(ambient+Ke)+baseCol*diffuse*lightColor+specular;
// Add reflection with fresnel
float fresnel=Fresnel(0.15,0.85,2.0,normalize(IN.I),normalize(N));
baseCol.rgb=FresnelMix(baseCol.rgb,envColor.rgb,(Kr>0?Kr:-Kr*baseCol.a),fresnel);
// HDR toning of sky
//skyColor.rgb=1.0-exp(-exposure*skyColor.rgb);
// Mix sky with texture color based on atmospheric influence
outColor.rgb=lerp(skyColor,baseCol,IN.extinction);
// Blending
outColor.a=baseCol.a;
}
I think it's really important that 'simple' shaders like that, which are essentially basics that just work, are added to the default shader folders in Racer releases. A great deal of cars can simply have this added and work fine with their alpha control for reflection strength (as we used to use on most old cars)
Hopefully we/Ruud can get all these cleaned up and standardised, since 95%+ of my time these days is just chasing bugs/problems when developing my content, rather than actually making it in a nice consistent environment.
A final can't come soon enough. I'm getting tired of Racer these days, it's just such a waste of time which is sad, but I just can't see why it is so difficult. We have some fantastic programmers and artists here (the shaders on this Jag are a perfect example!), but it's all wrapped in junk from a user/content creator POV.
I know Racer is a WIP, cripes, I've been here 8 years+ I think, but it's never been so hard to just make a bloody car shiny and not crash everything!
I think we should really start a thread for shaders and get a load of ones that should be defaults (as discussed on RSC), and then bin the rest. Those renderer folders are full of so much junk... while one of the most flexible (the one posted above and posted on RSC maybe 12 months ago now), isn't even in there yet!
Grrr :biggrin:
Dave