Code: Select all
#if 0
*** hlms_uv_count0 2
*** uv_emissive 0
*** first_valid_detail_map_nm 4
*** fresnel_scalar 0
*** envprobe_map_sampler 1
*** hlms_uv_count 1
*** uv_detail_nm1 0
*** hlms_lights_spotparams 0
*** uv_detail_nm2 0
*** envMapRegSampler 1
*** emissive_map_sampler 1
*** uv_specular 0
*** hlms_disable_stage 0
*** specular_map_sampler 1
*** texcoord 5
*** fast_shader_build_hack 1
*** glsl 635204550
*** normal_sampling_format -1392068498
*** hlms_high_quality 0
*** hlms_lights_directional 0
*** samplerStateStart 1
*** alpha_test 0
*** roughness_map_sampler 2
*** glsles 1070293233
*** metallic_workflow 0
*** hw_gamma_write 1
*** uv_detail_weight 0
*** roughness_map_idx 1
*** detail_map_nm2_sampler 1
*** cubemaps_as_diffuse_gi 1
*** uv_detail_nm3 0
*** hlms_lights_spot 1
*** detail_map1_sampler 1
*** uv_normal 0
*** detail_map_nm3_sampler 1
*** hlms_alphablend 0
*** num_textures 2
*** normal_map_tex 2
*** uv_detail3 0
*** detail_map3_sampler 1
*** normal_map 1
*** hlms_tangent 1
*** uv_detail1 0
*** fresnel_workflow 1
*** alpha_test_shadow_caster_only 0
*** materials_per_buffer 2
*** hw_gamma_read 1
*** normal_map_tex_idx 1
*** hlms_skeleton 0
*** hlms_pssm_splits_minus_one -1
*** partial_pso_clip_distances 0
*** syntax -334286542
*** NeedsMoreThan1BonePerVertex -1
*** hlms_lights_point 1
*** diffuse_map_sampler 2
*** metal -1698855755
*** detail_map_nm1_sampler 1
*** s_lights_directional_non_caster 1
*** uv_detail0 0
*** uv_diffuse 0
*** diffuse_map 1
*** needs_refl_dir 1
*** uv_detail_nm0 0
*** detail_weight_map_sampler 1
*** normal_rg_snorm -1392068498
*** specular_map 2
*** diffuse_map_idx 0
*** hlms_lights_attenuation 0
*** detail_map_nm0_sampler 1
*** hlms_render_depth_only 0
*** normal_map_tex_sampler 2
*** uv_detail2 0
*** detail_map2_sampler 1
*** full_pso_clip_distances 0
*** textureMaps0 1
*** detail_map0_sampler 1
*** uv_roughness 0
*** roughness_map 2
*** receive_shadows 1
*** textureMaps1 2
*** needs_view_dir 1
*** BRDF_CookTorrance 1
*** use_planar_reflections 0
*** specular_map_idx 1
*** ambient_hemisphere 1
*** hlms_normal 1
*** num_samplers 2
*** hlsl -334286542
*** normal_weight 0
DONE DUMPING PROPERTIES
DONE DUMPING PIECES
#endif
//#include "SyntaxHighlightingMisc.h"
#define ushort uint
#define ogre_float4x3 float4x3
//Short used for read operations. It's an int in GLSL & HLSL. An ushort in Metal
#define rshort2 int2
//Short used for write operations. It's an int in GLSL. An ushort in HLSL & Metal
#define wshort2 uint2
#define toFloat3x3( x ) ((float3x3)(x))
#define buildFloat3x3( row0, row1, row2 ) transpose( float3x3( row0, row1, row2 ) )
#define min3( a, b, c ) min( a, min( b, c ) )
#define max3( a, b, c ) max( a, max( b, c ) )
#define INLINE
#define NO_INTERPOLATION_PREFIX nointerpolation
#define NO_INTERPOLATION_SUFFIX
#define finalDrawId input.drawId
#define PARAMS_ARG_DECL
#define PARAMS_ARG
#define floatBitsToUint(x) asuint(x)
#define uintBitsToFloat(x) asfloat(x)
#define floatBitsToInt(x) asint(x)
#define fract frac
#define lessThan( a, b ) (a < b)
#define inVs_vertexId input.vertexId
#define inVs_vertex input.vertex
#define inVs_blendWeights input.blendWeights
#define inVs_blendIndices input.blendIndices
#define inVs_qtangent input.qtangent
#define inVs_drawId input.drawId
#define inVs_uv0 input.uv0
#define outVs_Position outVs.gl_Position
#define outVs_clipDistance0 outVs.gl_ClipDistance0
#define gl_SampleMaskIn0 gl_SampleMask
#define interpolateAtSample( interp, subsample ) EvaluateAttributeAtSample( interp, subsample )
#define findLSB firstbitlow
#define outPs_colour0 outPs.colour0
#define OGRE_Sample( tex, sampler, uv ) tex.Sample( sampler, uv )
#define OGRE_SampleLevel( tex, sampler, uv, lod ) tex.SampleLevel( sampler, uv, lod )
#define OGRE_SampleArray2D( tex, sampler, uv, arrayIdx ) tex.Sample( sampler, float3( uv, arrayIdx ) )
#define OGRE_SampleArray2DLevel( tex, sampler, uv, arrayIdx, lod ) tex.SampleLevel( sampler, float3( uv, arrayIdx ), lod )
#define OGRE_SampleArrayCubeLevel( tex, sampler, uv, arrayIdx, lod ) tex.SampleLevel( sampler, float4( uv, arrayIdx ), lod )
#define OGRE_SampleGrad( tex, sampler, uv, ddx, ddy ) tex.SampleGrad( sampler, uv, ddx, ddy )
#define OGRE_SampleArray2DGrad( tex, sampler, uv, arrayIdx, ddx, ddy ) tex.SampleGrad( sampler, float3( uv, arrayIdx ), ddx, ddy )
#define OGRE_ddx( val ) ddx( val )
#define OGRE_ddy( val ) ddy( val )
#define OGRE_Load2D( tex, iuv, lod ) tex.Load( int3( iuv, lod ) )
#define OGRE_Load2DMS( tex, iuv, subsample ) tex.Load( iuv, subsample )
#define bufferFetch( buffer, idx ) buffer.Load( idx )
#define bufferFetch1( buffer, idx ) buffer.Load( idx ).x
#define CONST_BUFFER( bufferName, bindingPoint ) cbuffer bufferName : register(b##bindingPoint)
#define CONST_BUFFER_STRUCT_BEGIN( structName, bindingPoint ) cbuffer structName : register(b##bindingPoint) { struct _##structName
#define CONST_BUFFER_STRUCT_END( variableName ) variableName; }
#define FLAT_INTERPOLANT( decl, bindingPoint ) nointerpolation decl : TEXCOORD##bindingPoint
#define INTERPOLANT( decl, bindingPoint ) decl : TEXCOORD##bindingPoint
#define UV_DIFFUSE(x) (x)
#define UV_NORMAL(x) (x)
#define UV_SPECULAR(x) (x)
#define UV_ROUGHNESS(x) (x)
#define UV_DETAIL_WEIGHT(x) (x)
#define UV_DETAIL0(x) (x)
#define UV_DETAIL1(x) (x)
#define UV_DETAIL2(x) (x)
#define UV_DETAIL3(x) (x)
#define UV_DETAIL_NM0(x) (x)
#define UV_DETAIL_NM1(x) (x)
#define UV_DETAIL_NM2(x) (x)
#define UV_DETAIL_NM3(x) (x)
#define UV_EMISSIVE(x) (x)
#define float_fresnel float
#define make_float_fresnel( x ) x
#define OGRE_DEPTH_CMP_GE( a, b ) (a) <= (b)
#define OGRE_DEPTH_DEFAULT_CLEAR 0.0
struct PixelData
{
float3 normal;
float3 geomNormal;
float4 diffuse;
float3 specular;
float roughness;
float_fresnel F0;
float3 viewDir;
float NdotV;
float3 reflDir;
float3 envColourS;
float3 envColourD;
};
#define SampleDetailWeightMap( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx )
#define SampleDiffuse( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx )
#define SampleSpecular( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx )
#define SampleRoughness( tex, sampler, uv, arrayIdx ) OGRE_SampleArray2D( tex, sampler, uv, arrayIdx )
INLINE float3 reconstructZfromTSNormal( float2 tsNormal2 )
{
float3 tsNormal;
tsNormal.xy = tsNormal2.xy;
tsNormal.z = sqrt( max( 0.0f, 1.0f - tsNormal.x * tsNormal.x - tsNormal.y * tsNormal.y ) );
return tsNormal.xyz;
}
//Normal texture must be in UV8/RG8_SNORM or BC5S format!
#define getTSNormal( normalMap, samplerState, uv, normalIdx ) reconstructZfromTSNormal( OGRE_SampleArray2D( normalMap, samplerState, uv, normalIdx ).xy )
//Cook-Torrance
INLINE float3 BRDF( float3 lightDir, float3 lightDiffuse, float3 lightSpecular, PixelData pixelData )
{
float3 halfWay = normalize( lightDir + pixelData.viewDir );
float NdotL = saturate( dot( pixelData.normal, lightDir ) );
float NdotH = clamp( dot( pixelData.normal, halfWay ), 0.001, 1.0 );
float VdotH = clamp( dot( pixelData.viewDir, halfWay ), 0.001, 1.0 );
float sqR = pixelData.roughness * pixelData.roughness;
//Roughness/Distribution/NDF term (Beckmann distribution)
//Formula:
// Where alpha = NdotH and m = roughness
// R = [ 1 / (m^2 x cos(alpha)^4 ] x [ e^( -tan(alpha)^2 / m^2 ) ]
// R = [ 1 / (m^2 x cos(alpha)^4 ] x [ e^( ( cos(alpha)^2 - 1 ) / (m^2 cos(alpha)^2 ) ]
float NdotH_sq = NdotH * NdotH;
float roughness_a = 1.0 / ( 3.141592654 * sqR * NdotH_sq * NdotH_sq );//( 1 / (m^2 x cos(alpha)^4 )
float roughness_b = NdotH_sq - 1.0; //( cos(alpha)^2 - 1 )
float roughness_c = sqR * NdotH_sq; //( m^2 cos(alpha)^2 )
//Avoid Inf * 0 = NaN; we need Inf * 0 = 0
float R = min( roughness_a, 65504.0 ) * exp( roughness_b / roughness_c );
//Geometric/Visibility term (Cook Torrance)
float shared_geo = 2.0 * NdotH / VdotH;
float geo_b = shared_geo * pixelData.NdotV;
float geo_c = shared_geo * NdotL;
float G = min( 1.0, min( geo_b, geo_c ) );
//Fresnel term (Schlick's approximation)
//Formula:
// fresnelS = lerp( (1 - V*H)^5, 1, F0 )
// fresnelD = lerp( (1 - N*L)^5, 1, 1 - F0 ) [See s2010_course_note_practical_implementation_at_triace.pdf]
float_fresnel fresnelS = pixelData.F0 + pow( 1.0 - VdotH, 5.0 ) * (1.0 - pixelData.F0);
float fresnelD = 1.0f - fresnelS;
//Avoid very small denominators, they go to NaN or cause aliasing artifacts
float_fresnel Rs = ( fresnelS * (R * G) ) / max( 4.0 * pixelData.NdotV * NdotL, 0.01 );
return NdotL * (pixelData.specular.xyz * lightSpecular * Rs +
pixelData.diffuse.xyz * lightDiffuse * fresnelD);
}
// START UNIFORM DECLARATION
struct ShadowReceiverData
{
float4x4 texViewProj;
float2 shadowDepthRange;
float2 padding;
float4 invShadowMapSize;
};
struct Light
{
float3 position;
uint lightMask;
float4 diffuse; //.w contains numNonCasterDirectionalLights
float3 specular;
};
#define numNonCasterDirectionalLights lights[0].diffuse.w
#define areaLightDiffuseMipmapStart areaApproxLights[0].diffuse.w
#define areaLightNumMipmapsSpecFactor areaApproxLights[0].specular.w
#define numAreaApproxLights areaApproxLights[0].doubleSided.y
#define numAreaApproxLightsWithMask areaApproxLights[0].doubleSided.z
#define numAreaLtcLights areaLtcLights[0].points[0].w
struct AreaLight
{
float3 position;
uint lightMask;
float4 diffuse; //[0].w contains diffuse mipmap start
float4 specular; //[0].w contains mipmap scale
float4 attenuation; //.w contains texture array idx
//Custom 2D Shape:
// direction.xyz direction
// direction.w invHalfRectSize.x
// tangent.xyz tangent
// tangent.w invHalfRectSize.y
float4 direction;
float4 tangent;
float4 doubleSided; //.y contains numAreaApproxLights
//.z contains numAreaApproxLightsWithMask
};
struct AreaLtcLight
{
float3 position;
uint lightMask;
float4 diffuse; //.w contains attenuation range
float4 specular; //.w contains doubleSided
float4 points[4]; //.w contains numAreaLtcLights
};
//Uniforms that change per pass
CONST_BUFFER_STRUCT_BEGIN( PassBuffer, 0 )
{
//Vertex shader (common to both receiver and casters)
float4x4 viewProj;
//Vertex shader
float4x4 view;
//-------------------------------------------------------------------------
//Pixel shader
float3x3 invViewMatCubemap;
float padding; //Compatibility with GLSL
float4 ambientUpperHemi;
float4 ambientLowerHemi;
float4 ambientHemisphereDir;
Light lights[1];
}
CONST_BUFFER_STRUCT_END( passBuf );
//Uniforms that change per Item/Entity, but change very infrequently
struct Material
{
/* kD is already divided by PI to make it energy conserving.
(formula is finalDiffuse = NdotL * surfaceDiffuse / PI)
*/
float4 bgDiffuse;
float4 kD; //kD.w is alpha_test_threshold
float4 kS; //kS.w is roughness
//Fresnel coefficient, may be per colour component (float3) or scalar (float)
//F0.w is transparency
float4 F0;
float4 normalWeights;
float4 cDetailWeights;
float4 detailOffsetScale[4];
float4 emissive; //emissive.w contains mNormalMapWeight.
float4 userValue[3];
uint4 indices0_3;
uint4 indices4_7;
};
CONST_BUFFER( MaterialBuf, 1 )
{
Material materialArray[2];
};
//Uniforms that change per Item/Entity
CONST_BUFFER( InstanceBuffer, 2 )
{
//.x =
//The lower 9 bits contain the material's start index.
//The higher 23 bits contain the world matrix start index.
//
//.y =
//shadowConstantBias. Send the bias directly to avoid an
//unnecessary indirection during the shadow mapping pass.
//Must be loaded with uintBitsToFloat
//
//.z =
//lightMask. Ogre must have been compiled with OGRE_NO_FINE_LIGHT_MASK_GRANULARITY
uint4 worldMaterialIdx[2];
};
// END UNIFORM DECLARATION
struct PS_INPUT
{
FLAT_INTERPOLANT( ushort drawId, 0 );
INTERPOLANT( float3 pos, 1 );
INTERPOLANT( float3 normal, 2 );
INTERPOLANT( float3 tangent, 3 );
INTERPOLANT( float2 uv0, 4 );
};
Texture2DArray textureMaps0 : register(t1);
Texture2DArray textureMaps1 : register(t2);
SamplerState samplerState1 : register(s1);
SamplerState samplerState2 : register(s2);
struct PS_OUTPUT
{
float4 colour0 : SV_Target0;
};
PS_OUTPUT main
(
PS_INPUT inPs
)
{
PS_OUTPUT outPs;
PixelData pixelData;
ushort materialId = worldMaterialIdx[inPs.drawId].x & 0x1FFu;
#define material materialArray[materialId]
ushort texIndex_diffuseIdx = material.indices0_3.x & 0x0000FFFFu;
ushort texIndex_normalIdx = material.indices0_3.x >> 16u;
ushort texIndex_specularIdx = material.indices0_3.y & 0x0000FFFFu;
ushort texIndex_roughnessIdx = material.indices0_3.y >> 16u;
/// Sample detail maps and weight them against the weight map in the next foreach loop.
/// DIFFUSE MAP
pixelData.diffuse = SampleDiffuse( textureMaps0,
samplerState2,
UV_DIFFUSE( inPs.uv0.xy ),
texIndex_diffuseIdx );
/// Blend the detail diffuse maps with the main diffuse.
/// Apply the material's diffuse over the textures
pixelData.diffuse.xyz *= material.kD.xyz;
/// SPECUlAR MAP
pixelData.specular.xyz = material.kS.xyz;
pixelData.F0 = material.F0.x;
pixelData.F0.xyz *= SampleSpecular( textureMaps1,
samplerState1,
UV_SPECULAR( inPs.uv0.xy ),
texIndex_specularIdx ).x;
/// ROUGHNESS MAP
pixelData.roughness = material.kS.w;
pixelData.roughness *= SampleRoughness( textureMaps1,
samplerState2,
UV_ROUGHNESS( inPs.uv0.xy ),
texIndex_roughnessIdx ).x;
pixelData.roughness = max( pixelData.roughness, 0.001f );
//Normal mapping.
pixelData.geomNormal = normalize( inPs.normal ) ;
float3 vTangent = normalize( inPs.tangent );
//Get the TBN matrix
float3 vBinormal = normalize( cross( pixelData.geomNormal, vTangent ) );
float3x3 TBN = buildFloat3x3( vTangent, vBinormal, pixelData.geomNormal );
pixelData.normal = getTSNormal( textureMaps1,
samplerState2,
UV_NORMAL( inPs.uv0.xy ),
texIndex_normalIdx );
/// If there is no normal map, the first iteration must
/// initialize pixelData.normal instead of try to merge with it.
/// Blend the detail normal maps with the main normal.
pixelData.normal = normalize( mul( TBN, pixelData.normal ) );
//Everything's in Camera space
pixelData.viewDir = normalize( -inPs.pos );
pixelData.NdotV = saturate( dot( pixelData.normal, pixelData.viewDir ) );
float3 finalColour = float3(0, 0, 0);
float3 lightDir;
float fDistance;
float3 tmpColour;
float spotCosAngle;
pixelData.reflDir = 2.0 * dot( pixelData.viewDir, pixelData.normal ) * pixelData.normal - pixelData.viewDir;
finalColour += BRDF( passBuf.lights[0].position.xyz, passBuf.lights[0].diffuse.xyz, passBuf.lights[0].specular, pixelData );
float ambientWD = dot( passBuf.ambientHemisphereDir.xyz, pixelData.normal ) * 0.5 + 0.5;
float ambientWS = dot( passBuf.ambientHemisphereDir.xyz, pixelData.reflDir ) * 0.5 + 0.5;
pixelData.envColourS = lerp( passBuf.ambientLowerHemi.xyz, passBuf.ambientUpperHemi.xyz, ambientWD );
pixelData.envColourD = lerp( passBuf.ambientLowerHemi.xyz, passBuf.ambientUpperHemi.xyz, ambientWS );
float VdotH = saturate( dot( pixelData.viewDir, normalize( pixelData.reflDir + pixelData.viewDir ) ) );
float_fresnel fresnelS = pixelData.F0 + pow( 1.0 - VdotH, 5.0 ) * (max( make_float_fresnel( 1.0 - pixelData.roughness ), pixelData.F0 ) - pixelData.F0);
float fresnelD = 1.0f - fresnelS;
finalColour += pixelData.envColourD * pixelData.diffuse.xyz * fresnelD +
pixelData.envColourS * pixelData.specular.xyz * fresnelS;
///!hlms_prepass
///!hlms_normal || hlms_qtangent
outPs_colour0.xyz = finalColour;
outPs_colour0.w = 1.0;
return outPs;
}
I cannot get the place you mentioned. It happens durction RenderOneFrame. This is my stacktrace:
Code: Select all
ucrtbased.dll!041634d6() Unbekannt
[Die unten aufgeführten Frames sind möglicherweise nicht korrekt und/oder fehlen, für "ucrtbased.dll" wurden keine Symbole geladen.] Unbekannt
[Externer Code]
RenderSystem_Direct3D11_d.dll!Ogre::D3D11HLSLProgram::getPixelShader() Zeile 2221 C++
RenderSystem_Direct3D11_d.dll!Ogre::D3D11RenderSystem::_setPipelineStateObject(const Ogre::HlmsPso * pso) Zeile 3193 C++
> OgreMain_d.dll!Ogre::CommandBuffer::execute_setPso(Ogre::CommandBuffer * _this, const Ogre::CbBase * _cmd) Zeile 47 C++
OgreMain_d.dll!Ogre::CommandBuffer::execute() Zeile 103 C++
OgreMain_d.dll!Ogre::RenderQueue::render(Ogre::RenderSystem * rs, unsigned char firstRq, unsigned char lastRq, bool casterPass, bool dualParaboloid) Zeile 460 C++
OgreMain_d.dll!Ogre::SceneManager::_renderPhase02(Ogre::Camera * camera, const Ogre::Camera * lodCamera, Ogre::Viewport * vp, unsigned char firstRq, unsigned char lastRq, bool includeOverlays) Zeile 1381 C++
OgreMain_d.dll!Ogre::Camera::_renderScenePhase02(const Ogre::Camera * lodCamera, Ogre::Viewport * vp, unsigned char firstRq, unsigned char lastRq, bool includeOverlays) Zeile 405 C++
OgreMain_d.dll!Ogre::Viewport::_updateRenderPhase02(Ogre::Camera * camera, const Ogre::Camera * lodCamera, unsigned char firstRq, unsigned char lastRq) Zeile 244 C++
OgreMain_d.dll!Ogre::CompositorPassScene::execute(const Ogre::Camera * lodCamera) Zeile 218 C++
OgreMain_d.dll!Ogre::CompositorNode::_update(const Ogre::Camera * lodCamera, Ogre::SceneManager * sceneManager) Zeile 892 C++
OgreMain_d.dll!Ogre::CompositorWorkspace::_update() Zeile 796 C++
OgreMain_d.dll!Ogre::CompositorManager2::_updateImplementation(Ogre::SceneManagerEnumerator & sceneManagers, Ogre::HlmsManager * hlmsManager) Zeile 727 C++
OgreMain_d.dll!Ogre::RenderSystem::updateCompositorManager(Ogre::CompositorManager2 * compositorManager, Ogre::SceneManagerEnumerator & sceneManagers, Ogre::HlmsManager * hlmsManager) Zeile 1357 C++
OgreMain_d.dll!Ogre::CompositorManager2::_update(Ogre::SceneManagerEnumerator & sceneManagers, Ogre::HlmsManager * hlmsManager) Zeile 654 C++
OgreMain_d.dll!Ogre::Root::_updateAllRenderTargets() Zeile 1578 C++
OgreMain_d.dll!Ogre::Root::renderOneFrame() Zeile 1100 C++
NOWA_Engine_d.dll!NOWA::AppStateManager::restrictedFPSRendering() Zeile 228 C++
NOWA_Engine_d.dll!NOWA::AppStateManager::start(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & applicationStateName, bool renderWhenInactive, bool restrictFps) Zeile 96 C++
NOWA_Design_d.exe!MainApplication::startSimulation(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & configName) Zeile 74 C++
NOWA_Design_d.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * __formal, char * strCmdLine, int __formal) Zeile 20 C++
[Externer Code]
There is nothing with "getMaterial".