DirectX 11 render system - work-in-progress
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
Hi, it is most probably because there is no more fixed function pipeline in DirectX 11, so you need to have each shader at the same time. It is all about the rendering process and you need to have the shaders compiled by the same compiler (as I have seen it so far). So if you need pixel and vertex shader in hlsl both or cg both.
If I will find anything else I will come with more things.
If I will find anything else I will come with more things.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- OGRE Team Member
- Posts: 185
- Joined: Mon Mar 24, 2008 4:54 pm
- Location: Kraków, Poland
- x 41
Re: DirectX 11 render system - work-in-progress
Huge discovery was made by DimA - all logical indices for shader parameters that are after any parameter that is not 1 vector register in size were calculated incorrectly, and trash is passed to the shader. Matrices, nested structs, samplers and so on are among such parameters. Fix is here https://bitbucket.org/sinbad/ogre/pull- ... d-for/diff
One more issue is with two-sided stencil buffer setup. Fix is here: https://bitbucket.org/sinbad/ogre/pull- ... es-in/diff
Stencil shadows worked after fixing both issues.
One more issue is with two-sided stencil buffer setup. Fix is here: https://bitbucket.org/sinbad/ogre/pull- ... es-in/diff
Stencil shadows worked after fixing both issues.
You do not have the required permissions to view the files attached to this post.
-
- Orc Shaman
- Posts: 788
- Joined: Mon Jan 18, 2010 6:06 pm
- Location: Costa Mesa, California
- x 24
Re: DirectX 11 render system - work-in-progress
Can I get an update on which samples are still not working? I've compiled and noticed there are still samples crashing.
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
I will give the new list tomorrow. I have some issues with my laptop and can't compile Ogre3D because of various depencencies, have to clean up my laptop (but it is my winter session now). Tomorrow I will go to the office (to work
, to continue to make new bugfixes), and will update a new list
. I will also put Eugene's changeset to my repo and try it.


Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
1. Compositor - OldMovie bad color, missing shaders for HDR and Gaussian blur. I have resolved Dither, Posterize, Radial blur, Halftone, OldTv (probably others but I do not remember exactly
)
2. Deferred shading - crash on start
3. Dual Quaternion - crash on start
4. Dynamic Texture - _resolved_
5. Instancing - there is just only one model rendered (or 2 if you set to render 160.)
6. Isosurf - crash on start
7. NewInstancing - a lot of visual bugs, you can't see any of the models.
8. SSAO techniques - crash on start
9. Shader system - sometimes bad skybox, error when trying multiple viewports or shadows.
10. Shader system texture fog - sky box does not appear on initializing, if you deselect and select again it will work
11. Grass sample - there is no animation on the grass, ogre head is rendered incorrectly (no normal mapping), Render System choose the fallback techniques from the material (do not know yet why).
12. Shadow sample - missing shaders which are supported by D3D11RS (there is no fixed pipeline in D3D11)
13. Terrain sample and volume rendering with LOD aimed terrain - crashes on start - probably because of colour mapping differences between D3D9 and D3D11.
14. Facial animation, multiple visual issues when changing anything to the face
This is the list. Today I have finished the work on the dynamic texture sample and will continue with the compositor sample.

2. Deferred shading - crash on start
3. Dual Quaternion - crash on start
4. Dynamic Texture - _resolved_
5. Instancing - there is just only one model rendered (or 2 if you set to render 160.)
6. Isosurf - crash on start
7. NewInstancing - a lot of visual bugs, you can't see any of the models.
8. SSAO techniques - crash on start
9. Shader system - sometimes bad skybox, error when trying multiple viewports or shadows.
10. Shader system texture fog - sky box does not appear on initializing, if you deselect and select again it will work
11. Grass sample - there is no animation on the grass, ogre head is rendered incorrectly (no normal mapping), Render System choose the fallback techniques from the material (do not know yet why).
12. Shadow sample - missing shaders which are supported by D3D11RS (there is no fixed pipeline in D3D11)
13. Terrain sample and volume rendering with LOD aimed terrain - crashes on start - probably because of colour mapping differences between D3D9 and D3D11.
14. Facial animation, multiple visual issues when changing anything to the face
This is the list. Today I have finished the work on the dynamic texture sample and will continue with the compositor sample.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
Today I have resolved all issues concerning the Gaussian blur. Old Movie still needs the sepia effect, I wrote a new shader for it and tried to play with the color, but was not working, the issue is again the color mapping, so it is needed to be recorected in the shader, but I haven't figured it out yet what texture color is needed to be multiplied.
On the OldTV compositor the 3D Noise texture isn't working well, vertex shader error probably, but the same vertex shader is used for other compositors which do work well.

Can someone look at the HDR and MotionBlur materials + shaders ? I wrote shaders (model 4.0) for them, I have tested these shaders with fxc.exe and I got no errors, but Ogre still stops when trying these compositors, saying attempt of rendering without both vertex and pixel shaders. Thanks
. The link of my repo is in my sginature (The new code fork for the project.)
The last missing compositor is heat vision which needs new shaders, I will write it them now
.
On the OldTV compositor the 3D Noise texture isn't working well, vertex shader error probably, but the same vertex shader is used for other compositors which do work well.

Can someone look at the HDR and MotionBlur materials + shaders ? I wrote shaders (model 4.0) for them, I have tested these shaders with fxc.exe and I got no errors, but Ogre still stops when trying these compositors, saying attempt of rendering without both vertex and pixel shaders. Thanks

The last missing compositor is heat vision which needs new shaders, I will write it them now

Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
I have finished writing the Heat Vision shader, but I have the same issue as with OldTV. Noise texture is not rendered correctly and I don't see my error.

Ogre log says this, but I do not understand what other things should I do to link pass 0 with pass 1 and pass 2 (if case) correctly:
Does anyone know what to do in this case ? 

Ogre log says this, but I do not understand what other things should I do to link pass 0 with pass 1 and pass 2 (if case) correctly:
Code: Select all
First-chance exception at 0x000007fefd279e5d in SampleBrowser_d.exe: Microsoft C++ exception: Ogre::FileNotFoundException at memory location 0x00a8d290..
First-chance exception at 0x000007fefd279e5d in SampleBrowser_d.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x000007fefd279e5d in SampleBrowser_d.exe: Microsoft C++ exception: Ogre::FileNotFoundException at memory location 0x00a8d290..
Error loading texture Input. Texture layer will be blank. Loading the texture failed with the following exception: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Input in resource group Popular or any other group. in ResourceGroupManager::openResource at ..\..\ogre3d-directx11\OgreMain\src\OgreResourceGroupManager.cpp (line 756)
The thread 'Win64 Thread' (0x1c44) has exited with code 0 (0x0).

Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- Orc Shaman
- Posts: 788
- Joined: Mon Jan 18, 2010 6:06 pm
- Location: Costa Mesa, California
- x 24
Re: DirectX 11 render system - work-in-progress
Can you post the shader and material files?
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
I didn't want to post them as they are huge, I said there are on my repository (in my signature, The link to the new project repo). But here they are:
HeatVision.hlsl :
HeatVision.material:
OldTV material
OldTV.hlsl
StdQuad_vp.hlsl
HeatVision.hlsl :
Code: Select all
cbuffer MatrixBuffer
{
matrix worldViewProj;
};
struct v2p
{
float4 position : SV_POSITION;
float2 texCoord : TEXCOORD0;
};
//////////////////////////////////////////////
// CASTER PASS //
// HEAT //
//////////////////////////////////////////////
v2p HeatCaster_vp(
// in
float4 vPos: POSITION,
float4 vNormal: NORMAL,
uniform float3 eyePosition // object space
)
{
v2p output;
float4 eyeDir = float4(eyePosition - vPos.xyz, 0);
eyeDir = normalize(eyeDir);
output.position = mul( worldViewProj, vPos );
output.texCoord = clamp( dot( vNormal, eyeDir ), 0, 1 );
return output;
}
float4 HeatCaster_fp(
v2p input
) : SV_Target
{
return float4(input.texCoord.x,input.texCoord.x,input.texCoord.x,1.0f);
}
//////////////////////////////////////////////
// CASTER PASS //
// COLD //
//////////////////////////////////////////////
v2p ColdCaster_vp(
// in
float4 vPos: POSITION,
float4 vNormal: NORMAL,
uniform float3 eyePosition // object space
)
{
v2p output;
float4 eyeDir = float4(eyePosition - vPos.xyz, 0);
eyeDir = normalize(eyeDir);
output.position = mul( worldViewProj, vPos );
output.texCoord = clamp( dot( vNormal, eyeDir ), 0, 1 );
return output;
}
float4 ColdCaster_fp(
// input from vp
v2p input
) : SV_Target
{
return float4(input.texCoord.x / 2,input.texCoord.x / 2,input.texCoord.x / 2,1.0f);
}
//////////////////////////////////////////////
// PASS 1 - Light to heat conversion //
//////////////////////////////////////////////
v2p LightToHeat_vp(
// in
float4 inPos: POSITION,
uniform float flipping
)
{
v2p output;
output.position = float4(inPos.x, flipping * inPos.y, 0.0f, 1.0f);
inPos.xy = sign(inPos.xy);
output.texCoord = (float2(inPos.x, -inPos.y) + 1.0f)/2.0f;
return output;
}
SamplerState g_samLinear
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = Wrap;
AddressV = Wrap;
};
float4 LightToHeat_fp(
// input from vp
v2p inp,
// params
uniform float4 random_fractions,
uniform float4 heatBiasScale,
uniform float4 depth_modulator,
uniform Texture2D Input, // output of HeatVisionCaster_fp (NdotV)
uniform Texture2D NoiseMap,
uniform Texture2D HeatLookup
) : SV_Target
{
float depth, heat, interference;
// Output constant color:
depth = Input.Sample(g_samLinear, inp.texCoord );
depth *= (depth * depth_modulator.x);
heat = (depth * heatBiasScale.y);
// if (depth > 0)
{
interference = -0.5 + NoiseMap.Sample(g_samLinear, inp.texCoord.xy + float2( random_fractions.x, random_fractions.y ) );
interference *= interference;
interference *= 1 - heat;
heat += interference;//+ heatBiasScale.x;
}
/*
heatBias isn't used for now
if (heat > 0)
heat += heatBiasScale.x;
*/
// Clamp UVs
heat = max( 0.005, min( 0.995, heat ) );
float4 outColor = HeatLookup.Sample(g_samLinear, float2( heat, 0.f ) );
return outColor;
}
//////////////////////////////////////////////
// PASS 2 - add simple blur (final pass) //
//////////////////////////////////////////////
v2p Blur_vp(
// in
float4 inPos: POSITION,
uniform float flipping
)
{
v2p output;
output.position = float4(inPos.x, flipping * inPos.y, 0.0f, 1.0f);
inPos.xy = sign(inPos.xy);
output.texCoord = (float2(inPos.x, -inPos.y) + 1.0f)/2.0f;
return output;
}
// ps_2_0
float4 Blur_fp(
// input from vp
v2p input,
// parameters
uniform Texture2D Input,
uniform float4 blurAmount
) : SV_Target
{
int i;
float4 tmpOutColor;
float diffuseGlowFactor;
const float2 offsets[4] =
{
/*
// hazy blur
-1.8, -1.8,
-1.8, 1.8,
1.8, -1.8,
1.8, 1.8
*/
/*
// less-hazy blur
-1.0, 2.0,
-1.0, -1.0,
1.0, -1.0,
1.0, 1.0
*/
/*
-0.326212, -0.405805,
-0.840144, -0.073580,
-0.695914, 0.457137,
-0.203345, 0.620716
*/
-0.3, 0.4,
-0.3, -0.4,
0.3, -0.4,
0.3, 0.4
};
tmpOutColor = Input.Sample(g_samLinear, input.texCoord ); // UV coords are in image space
// calculate glow amount
diffuseGlowFactor = 0.0113f * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));
// basic blur filter
for (i = 0; i < 4; i++) {
tmpOutColor += Input.Sample(g_samLinear, input.texCoord.xy + blurAmount.x * diffuseGlowFactor * offsets[i] );
}
tmpOutColor *= 0.25;
// TIPS (old-skool strikes again!)
// Pay attention here! If you use the "out float4 outColor" directly
// in your steps while creating the output color (like you remove
// the "tmpOutColor" var and just use the "outColor" directly)
// your pixel-color output IS CHANGING EACH TIME YOU DO AN ASSIGNMENT TOO!
// A temporary variable, instead, acts like a per-pixel double buffer, and
// best of all, lead to better performance.
float4 outColor = tmpOutColor;
return outColor;
}
Code: Select all
///////////////////////////////////
// PASS 0
// HEAT CASTERS PASS
///////////////////////////////////
vertex_program Fury/HeatVision/HeatCaster_Cg_vp cg
{
source HeatVision.cg
entry_point HeatCaster_vp
profiles vs_1_1 arbvp1
}
fragment_program Fury/HeatVision/HeatCaster_Cg_fp cg
{
source HeatVision.cg
entry_point HeatCaster_fp
profiles ps_2_0 arbfp1
}
vertex_program Fury/HeatVision/HeatCaster_HLSL_vp hlsl
{
source HeatVision.hlsl
entry_point HeatCaster_vp
target vs_4_0
}
fragment_program Fury/HeatVision/HeatCaster_HLSL_fp hlsl
{
source HeatVision.hlsl
entry_point HeatCaster_fp
target ps_4_0
}
vertex_program Fury/HeatVision/HeatCaster_GLSLES_vp glsles
{
source HeatCasterVp.glsles
}
fragment_program Fury/HeatVision/HeatCaster_GLSLES_fp glsles
{
source HeatCasterFp.glsles
}
vertex_program Fury/HeatVision/HeatCaster_GLSL_vp glsl
{
source HeatCasterVp.glsl
syntax glsl150
}
fragment_program Fury/HeatVision/HeatCaster_GLSL_fp glsl
{
source HeatCasterFp.glsl
syntax glsl150
}
vertex_program Fury/HeatVision/HeatCaster_vp unified
{
delegate Fury/HeatVision/HeatCaster_GLSL_vp
delegate Fury/HeatVision/HeatCaster_GLSLES_vp
delegate Fury/HeatVision/HeatCaster_HLSL_vp
delegate Fury/HeatVision/HeatCaster_Cg_vp
}
fragment_program Fury/HeatVision/HeatCaster_fp unified
{
delegate Fury/HeatVision/HeatCaster_GLSL_fp
delegate Fury/HeatVision/HeatCaster_GLSLES_fp
delegate Fury/HeatVision/HeatCaster_HLSL_fp
delegate Fury/HeatVision/HeatCaster_Cg_fp
}
material Fury/HeatVision/HeatCaster
{
technique
{
pass
{
vertex_program_ref Fury/HeatVision/HeatCaster_vp
{
param_named_auto eyePosition camera_position_object_space
param_named_auto worldViewProj worldviewproj_matrix
}
fragment_program_ref Fury/HeatVision/HeatCaster_fp
{
}
}
}
}
///////////////////////////////////
// PASS 0
// HEAT CASTERS PASS
///////////////////////////////////
vertex_program Fury/HeatVision/ColdCaster_Cg_vp cg
{
source HeatVision.cg
entry_point ColdCaster_vp
profiles vs_1_1 arbvp1
}
fragment_program Fury/HeatVision/ColdCaster_Cg_fp cg
{
source HeatVision.cg
entry_point ColdCaster_fp
profiles ps_2_0 arbfp1
}
vertex_program Fury/HeatVision/ColdCaster_HLSL_vp hlsl
{
source HeatVision.hlsl
entry_point ColdCaster_vp
target vs_4_0
}
fragment_program Fury/HeatVision/ColdCaster_HLSL_fp hlsl
{
source HeatVision.hlsl
entry_point ColdCaster_fp
target ps_4_0
}
vertex_program Fury/HeatVision/ColdCaster_GLSLES_vp glsles
{
source ColdCasterVp.glsles
}
fragment_program Fury/HeatVision/ColdCaster_GLSLES_fp glsles
{
source ColdCasterFp.glsles
}
vertex_program Fury/HeatVision/ColdCaster_GLSL_vp glsl
{
source ColdCasterVp.glsl
syntax glsl150
}
fragment_program Fury/HeatVision/ColdCaster_GLSL_fp glsl
{
source ColdCasterFp.glsl
syntax glsl150
}
vertex_program Fury/HeatVision/ColdCaster_vp unified
{
delegate Fury/HeatVision/ColdCaster_GLSL_vp
delegate Fury/HeatVision/ColdCaster_GLSLES_vp
delegate Fury/HeatVision/ColdCaster_HLSL_vp
delegate Fury/HeatVision/ColdCaster_Cg_vp
}
fragment_program Fury/HeatVision/ColdCaster_fp unified
{
delegate Fury/HeatVision/ColdCaster_GLSL_fp
delegate Fury/HeatVision/ColdCaster_GLSLES_fp
delegate Fury/HeatVision/ColdCaster_HLSL_fp
delegate Fury/HeatVision/ColdCaster_Cg_fp
}
material Fury/HeatVision/ColdCaster
{
technique
{
pass
{
vertex_program_ref Fury/HeatVision/ColdCaster_vp
{
param_named_auto eyePosition camera_position_object_space
param_named_auto worldViewProj worldviewproj_matrix
}
fragment_program_ref Fury/HeatVision/ColdCaster_fp
{
}
}
}
}
///////////////////////////////////
// PASS 1
// LIGHT TO HEAT CONVERSION PASS
///////////////////////////////////
vertex_program Fury/HeatVision/LightToHeat_Cg_vp cg
{
source HeatVision.cg
entry_point LightToHeat_vp
profiles vs_1_1 arbvp1
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/LightToHeat_Cg_fp cg
{
source HeatVision.cg
entry_point LightToHeat_fp
profiles ps_2_0 arbfp1
}
vertex_program Fury/HeatVision/LightToHeat_HLSL_vp hlsl
{
source HeatVision.hlsl
entry_point LightToHeat_vp
target vs_4_0
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/LightToHeat_HLSL_fp hlsl
{
source HeatVision.hlsl
entry_point LightToHeat_fp
target ps_4_0
}
vertex_program Fury/HeatVision/LightToHeat_GLSLES_vp glsles
{
source LightToHeatVp.glsles
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/LightToHeat_GLSLES_fp glsles
{
source LightToHeatFp.glsles
default_params
{
param_named Input int 0
param_named NoiseMap int 1
param_named HeatLookup int 2
}
}
vertex_program Fury/HeatVision/LightToHeat_GLSL_vp glsl
{
source LightToHeatVp.glsl
syntax glsl150
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/LightToHeat_GLSL_fp glsl
{
source LightToHeatFp.glsl
syntax glsl150
default_params
{
param_named Input int 0
param_named NoiseMap int 1
param_named HeatLookup int 2
}
}
vertex_program Fury/HeatVision/LightToHeat_vp unified
{
delegate Fury/HeatVision/LightToHeat_GLSL_vp
delegate Fury/HeatVision/LightToHeat_GLSLES_vp
delegate Fury/HeatVision/LightToHeat_HLSL_vp
delegate Fury/HeatVision/LightToHeat_Cg_vp
}
fragment_program Fury/HeatVision/LightToHeat_fp unified
{
delegate Fury/HeatVision/LightToHeat_GLSL_fp
delegate Fury/HeatVision/LightToHeat_GLSLES_fp
delegate Fury/HeatVision/LightToHeat_HLSL_fp
delegate Fury/HeatVision/LightToHeat_Cg_fp
}
material Fury/HeatVision/LightToHeat
{
technique
{
// pass 1
pass
{
cull_hardware none
cull_software none
depth_func always_pass
vertex_program_ref Fury/HeatVision/LightToHeat_vp
{
}
fragment_program_ref Fury/HeatVision/LightToHeat_fp
{
// these should be *really* random!
param_named random_fractions float4 0.3 0.7 0 0
param_named depth_modulator float4 0.6 0 0 0
// this one can be fixed
param_named heatBiasScale float4 0.0 1.0 0 0
}
// INPUT (from scene, where entities has "Fury/HeatVision/Caster" material for heat emanation)
texture_unit
{
tex_coord_set 0
filtering linear linear none
tex_address_mode clamp
}
// Noise map
texture_unit
{
texture HeatNoise.tga
tex_coord_set 0
}
// heat conversion texture
texture_unit
{
texture HeatLookup.tga
tex_coord_set 0
filtering point point none
}
}
}
}
///////////////////////////////////
// PASS 2
// BLUR PASS
///////////////////////////////////
vertex_program Fury/HeatVision/Blur_Cg_vp cg
{
source HeatVision.cg
entry_point Blur_vp
profiles vs_1_1 arbvp1
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/Blur_Cg_fp cg
{
source HeatVision.cg
entry_point Blur_fp
profiles ps_2_0 arbfp1
}
vertex_program Fury/HeatVision/Blur_HLSL_vp hlsl
{
source HeatVision.hlsl
entry_point Blur_vp
target vs_4_0
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/Blur_HLSL_fp hlsl
{
source HeatVision.hlsl
entry_point Blur_fp
target ps_4_0
}
vertex_program Fury/HeatVision/Blur_GLSLES_vp glsles
{
source HeatBlurVp.glsles
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/Blur_GLSLES_fp glsles
{
source HeatBlurFp.glsles
default_params
{
param_named Input int 0
}
}
vertex_program Fury/HeatVision/Blur_GLSL_vp glsl
{
source HeatBlurVp.glsl
syntax glsl150
default_params
{
param_named_auto flipping render_target_flipping
}
}
fragment_program Fury/HeatVision/Blur_GLSL_fp glsl
{
source HeatBlurFp.glsl
syntax glsl150
default_params
{
param_named Input int 0
}
}
vertex_program Fury/HeatVision/Blur_vp unified
{
delegate Fury/HeatVision/Blur_GLSL_vp
delegate Fury/HeatVision/Blur_GLSLES_vp
delegate Fury/HeatVision/Blur_HLSL_vp
delegate Fury/HeatVision/Blur_Cg_vp
}
fragment_program Fury/HeatVision/Blur_fp unified
{
delegate Fury/HeatVision/Blur_GLSL_fp
delegate Fury/HeatVision/Blur_GLSLES_fp
delegate Fury/HeatVision/Blur_HLSL_fp
delegate Fury/HeatVision/Blur_Cg_fp
}
material Fury/HeatVision/Blur
{
technique
{
// pass 1
pass
{
cull_hardware none
cull_software none
depth_func always_pass
vertex_program_ref Fury/HeatVision/Blur_vp
{
}
fragment_program_ref Fury/HeatVision/Blur_fp
{
param_named blurAmount float4 0.5 0 0 0
}
// INPUT (from previous)
texture_unit
{
texture Input
tex_coord_set 0
filtering linear linear none
tex_address_mode clamp
}
}
}
}
Code: Select all
fragment_program Ogre/Compositor/OldTV_FPCg cg
{
source OldTV.cg
entry_point OldTV_ps
profiles ps_2_0 arbfp1
}
fragment_program Ogre/Compositor/OldTV_FPGLSL glsl
{
source OldTV.glsl
syntax glsl150
default_params
{
param_named Image int 0
param_named Rand int 1
param_named Noise int 2
}
}
fragment_program Ogre/Compositor/OldTV_FPHLSL hlsl
{
source OldTV.hlsl
entry_point OldTV_ps
target ps_4_0
}
fragment_program Ogre/Compositor/OldTV_FP unified
{
delegate Ogre/Compositor/OldTV_FPGLSL
delegate Ogre/Compositor/OldTV_FPHLSL
delegate Ogre/Compositor/OldTV_FPCg
}
material Ogre/Compositor/OldTV
{
technique
{
pass
{
depth_check off
vertex_program_ref Ogre/Compositor/StdQuad_Tex2a_vp
{
}
fragment_program_ref Ogre/Compositor/OldTV_FP
{
param_named distortionFreq float 2.7
param_named distortionScale float 2.5
param_named distortionRoll float 0.93
param_named inerference float 0.5
param_named frameLimit float 0.40
param_named frameShape float 0.26
param_named frameSharpness float 6.0
param_named_auto time_0_X time_0_x 120
param_named_auto sin_time_0_X sintime_0_x 120
}
texture_unit 0
{
tex_coord_set 0
tex_address_mode clamp
filtering linear linear linear
}
texture_unit 1
{
texture Random3D.dds 3d
tex_coord_set 1
tex_address_mode wrap
filtering linear linear linear
}
texture_unit 2
{
texture NoiseVolume.dds 3d
tex_coord_set 2
tex_address_mode wrap
filtering linear linear linear
}
}
}
}
Code: Select all
Texture2D Image;
Texture3D Rand;
Texture3D Noise;
SamplerState g_samLinear
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = Wrap;
AddressV = Wrap;
};
struct v3p
{
float4 position : SV_POSITION;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
};
float4 OldTV_ps(v3p input,
uniform float distortionFreq: register(c3),
uniform float distortionScale: register(c4),
uniform float distortionRoll: register(c5),
uniform float inerference: register(c7),
uniform float frameLimit: register(c8),
uniform float frameShape: register(c0),
uniform float frameSharpness: register(c1),
uniform float time_0_X: register(c2),
uniform float sin_time_0_X: register(c6)
) : SV_Target {
// Define a frame shape
float f = (1 - input.texCoord2.x * input.texCoord2.x) * (1 - input.texCoord2.y * input.texCoord2.y);
float frame = saturate(frameSharpness * (pow(f, frameShape) - frameLimit));
// Interference ... just a texture filled with rand()
float4 rand = Rand.Sample(g_samLinear, float3(1.5 * input.texCoord2, time_0_X));
rand -= float4(0.2,0.2,0.2,0.2);
// Some signed noise for the distortion effect
float4 noisy = Noise.Sample(g_samLinear, float3(0, 0.5 * input.texCoord2.y, 0.1 * time_0_X));
noisy -= float4(0.5,0.5,0.5,0.5);
// Repeat a 1 - x^2 (0 < x < 1) curve and roll it with sinus.
float dst = frac(input.texCoord2.y * distortionFreq + distortionRoll * sin_time_0_X);
dst *= (1 - dst);
// Make sure distortion is highest in the center of the image
dst /= 1 + distortionScale * abs(input.texCoord2.y);
// ... and finally distort
input.texCoord.x += distortionScale * noisy.x * dst;
float4 image = Image.Sample(g_samLinear, input.texCoord);
// Combine frame, distorted image and interference
return frame * (inerference * rand + image);
}
Code: Select all
cbuffer MatrixBuffer
{
matrix worldViewProj;
};
struct VS_OUTPUT {
float4 Pos : SV_Position;
float2 texCoord : TEXCOORD0;
};
struct VS_OUTPUT2 {
float4 Pos : SV_Position;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
};
struct VS_OUTPUT3 {
float4 Pos : SV_Position;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
float2 texCoord3 : TEXCOORD2;
};
struct VS_OUTPUT4 {
float4 Pos : SV_Position;
float2 texCoord : TEXCOORD0;
float2 texCoord2 : TEXCOORD1;
float2 texCoord3 : TEXCOORD2;
float2 texCoord4 : TEXCOORD3;
};
VS_OUTPUT StdQuad_vp
(
float4 inPos : POSITION
)
{
VS_OUTPUT Out;
// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
inPos.w = 1.0f;
Out.Pos = mul(worldViewProj, inPos);
// The input positions adjusted by texel offsets, so clean up inaccuracies
inPos.xy = sign(inPos.xy);
// Convert to image-space
Out.texCoord = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
return Out;
}
VS_OUTPUT2 StdQuad_Tex2_vp
(
float4 inPos : POSITION
)
{
VS_OUTPUT2 Out;
// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
inPos.w = 1.0f;
Out.Pos = mul(worldViewProj, inPos);
// The input positions adjusted by texel offsets, so clean up inaccuracies
inPos.xy = sign(inPos.xy);
// Convert to image-space
Out.texCoord = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
Out.texCoord2 = Out.texCoord;
return Out;
}
VS_OUTPUT2 StdQuad_Tex2a_vp
(
float4 inPos : POSITION
)
{
VS_OUTPUT2 Out;
// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
inPos.w = 1.0f;
Out.Pos = mul(worldViewProj, inPos);
// The input positions adjusted by texel offsets, so clean up inaccuracies
inPos.xy = sign(inPos.xy);
// Convert to image-space
Out.texCoord = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
Out.texCoord2 = inPos.xy;
return Out;
}
VS_OUTPUT3 StdQuad_Tex3_vp
(
float4 inPos : POSITION
)
{
VS_OUTPUT3 Out;
// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
inPos.w = 1.0f;
Out.Pos = mul(worldViewProj, inPos);
// The input positions adjusted by texel offsets, so clean up inaccuracies
inPos.xy = sign(inPos.xy);
// Convert to image-space
Out.texCoord = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
Out.texCoord2 = Out.texCoord;
Out.texCoord3 = Out.texCoord;
return Out;
}
VS_OUTPUT4 StdQuad_Tex4_vp
(
float4 inPos : POSITION
)
{
VS_OUTPUT4 Out;
// Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
inPos.w = 1.0f;
Out.Pos = mul(worldViewProj, inPos);
// The input positions adjusted by texel offsets, so clean up inaccuracies
inPos.xy = sign(inPos.xy);
// Convert to image-space
Out.texCoord = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
Out.texCoord2 = Out.texCoord;
Out.texCoord3 = Out.texCoord;
Out.texCoord4 = Out.texCoord;
return Out;
}
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
Does anyone had time to look over these shaders ? I am really trying to resolve the problems, but I do not find anything. I probably miss out something, but I do not have any clue.
Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: DirectX 11 render system - work-in-progress
I know I've seen that exact issue with some of the GLSL compositors before. If I recall it had to do with something in the StdQuad shaders that I was doing wrong. So I'd look there first.
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
The problem is that almost every compositor is using the same StdQuad vertex shaders, which I've updated to SM 4.0 as for other types of shader models the old CG shaders resolve that pass. All the other compositors using these vertex shaders are working, but here I have a problem because of multiple textures, as these has the most textures (3 in number). Because of this the 3rd (in this case the Noise texture) is not positioned and stretch correctly. Can you suggest something more you have done different with StdQuad shaders for multiple textures ? 

Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- OGRE Retired Team Member
- Posts: 4270
- Joined: Sun Feb 25, 2007 4:56 am
- Location: Bloomington, MN
- x 126
Re: DirectX 11 render system - work-in-progress
Check out StdQuad_Tex2a_vp.glsles. I just added a second UV output to it. In this case I had to because things such as gl_TexCoord was removed from the shading language.
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
You can also check out the StdQuad_vp.hlsl -> StdQuad_Tex2a_vp at my repo (link in my signature), uses the same construction as the glsles / cg / glsl. Using a second texcoord output and using the same calculation of the points. I checked out every StdQuad vertex shader (cg, glsles, glsl). Does you have any other advices ? 

Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- Gremlin
- Posts: 154
- Joined: Sun Jun 07, 2009 9:04 pm
- Location: Bogotá, Colombia
- x 4
Re: DirectX 11 render system - work-in-progress
Hi robert...
For the OldTv shader you just must use a SamplerState for a volume in this way:
And when sample the 3d textures ....
I have proved it and worked fine... i haven't commited because i really don't understand hg, i'm not familiar with
I think so the same issue is occurring with the heat vision, so try the change and tell what happen...
For the OldTv shader you just must use a SamplerState for a volume in this way:
Code: Select all
SamplerState g_samVolume
{
Filter = MIN_MAG_LINEAR_MIP_POINT;
AddressU = Wrap;
AddressV = Wrap;
AddressW = Wrap;
};
And when sample the 3d textures ....
Code: Select all
float4 rand = Rand.Sample(g_samVolume, float3(1.5 * texCoord2, time_0_X));
.
.
.
float4 noisy = Noise.Sample(g_samVolume, float3(0, 0.5 * texCoord2.y, 0.1 * time_0_X));

I think so the same issue is occurring with the heat vision, so try the change and tell what happen...

Juan Camilo Acosta Arango
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
It is not working on my side. I get the same result with that visual bug. I go not know why is it not working. I am working on the instancing sample now, if you have any other suggestion please write 

Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: DirectX 11 render system - work-in-progress
Will have a look.
Watch out for my OGRE related tweets here.
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
I have been working for the last 2 days on the instancing sample and on shadows (PSSM). Shadows are working fine, but with instancing I have some issues (the old instancing).
First of all, if I deactivate the hlsl shaders (as it is now on the repo) everything is working fine, just the object named razor is not instanced correctly. Here is a screenshot of knot object instanced:

If I activate the hlsl shaders, the instancing sample runs, razor object is not instance correctly, just one object per row. But if I choose any other object and the technique of instancing the sample crashes. There is a linkage error between vertex and pixel shader. But from the output I am not sure that the pixel shader is the new hlsl shader or not, most probably not. What kind of shader is instancing using for every object ?

First of all, if I deactivate the hlsl shaders (as it is now on the repo) everything is working fine, just the object named razor is not instanced correctly. Here is a screenshot of knot object instanced:

If I activate the hlsl shaders, the instancing sample runs, razor object is not instance correctly, just one object per row. But if I choose any other object and the technique of instancing the sample crashes. There is a linkage error between vertex and pixel shader. But from the output I am not sure that the pixel shader is the new hlsl shader or not, most probably not. What kind of shader is instancing using for every object ?


Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: DirectX 11 render system - work-in-progress
Can you guys make a list of the issues you want me to have a look at?
(I don't want to miss anything...)
(I don't want to miss anything...)
Watch out for my OGRE related tweets here.
-
- Google Summer of Code Student
- Posts: 237
- Joined: Mon Apr 02, 2012 11:07 am
- x 42
Re: DirectX 11 render system - work-in-progress
It was just the compositor sample, the heat vision, oldTV and motion blur compositor
. I have just started to work on instancing sample, so if I will be more stacked then today I will tell it
. If you have time, you can also look over that 



Google Summer of Code 2013 Student
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
Topic: "DirectX 11 & Tessellation samples"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Assaf Raman
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: DirectX 11 render system - work-in-progress
Ok, on Friday I will fix them all.
Watch out for my OGRE related tweets here.
-
- Halfling
- Posts: 86
- Joined: Tue Sep 01, 2009 7:15 pm
- Location: Cologne, Germany
- x 4
Re: DirectX 11 render system - work-in-progress
Hello Robert and Assaf,
as you are currently working on the Compositor Samples for the DX11 RenderSystem, I have a question for you:
Does the bug described here, which occurs e.g. with the DX9 RenderSystem (only one I use atm) also occur in the DX11 RenderSystem when using Bloom Compositor + Wireframe?
If yes, do you think it is fixable? (as this would maybe also hint as how to fix it for DX9)
as you are currently working on the Compositor Samples for the DX11 RenderSystem, I have a question for you:
Does the bug described here, which occurs e.g. with the DX9 RenderSystem (only one I use atm) also occur in the DX11 RenderSystem when using Bloom Compositor + Wireframe?
If yes, do you think it is fixable? (as this would maybe also hint as how to fix it for DX9)
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: DirectX 11 render system - work-in-progress
Why is this bug important to you? What is your "real life" use for wireframe mode?
Watch out for my OGRE related tweets here.
-
- Halfling
- Posts: 86
- Joined: Tue Sep 01, 2009 7:15 pm
- Location: Cologne, Germany
- x 4
Re: DirectX 11 render system - work-in-progress
In a science/industry application where I select certain groups of vertices/triangles based on their position in the mesh, I sometimes switch from "beautiful" rendering to wireframe mode so I don't miss a vertice or triangle that should belong to the selected group.Assaf Raman wrote:Why is this bug important to you? What is your "real life" use for wireframe mode?
My workaround, as explained in the thread mentioned above, was to disable Bloom before entering Wireframe Mode, so it's not a show stopper.
I agree that this is a rare case, and based on the replies in the thread I assumed that nobody else would be interested in or benefit from fixing it.
But a bug is a bug, and as you guys were already having a look into the Compositor/RenderSystem interactions I thought it was worth giving it a shot and asking.
-
- OGRE Team Member
- Posts: 3092
- Joined: Tue Apr 11, 2006 3:58 pm
- Location: TLV, Israel
- x 76
Re: DirectX 11 render system - work-in-progress
Will have a look.
Watch out for my OGRE related tweets here.