DirectX 11 render system - work-in-progress

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

No, it's not, unfortunatelly. I had not time to finish it. I am working and also am still a student, so there is a little time for me, but I am trying to do everything. Hopefully here at work we will switch to Ogre3D 1.9 and DirectX 11 so as to work on Ogre core more. DirectX 11 Render System still needs the multi-device support, and there are still some open issues:
1. Compositor - bad color for the OldTV compositor
2. Deferred shading - crash on start
3. Dual Quaternion - crash on start
4. Dynamic Texture - wrong color of the frost texture (red, and it is supposed to be blue)
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, I think.)
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
14. Facial animation, multiple visual issues when changing anything to the face
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
User avatar
Assaf Raman
OGRE Team Member
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

Post by Assaf Raman »

Also - the old feature levels that are used by WinRT and WP8 have many issue.
Watch out for my OGRE related tweets here.
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

I have started to work again on the DirectX 11 Render System. ja0335 will help me to resolve all the problems.
In the first part I started to work on the color issues, more specifically OldTV compositor and Dynamic Texture. On the dynamic texture there is a bigger problem as I do not find any DXGI_FORMAT for 8-bit luminance. I have tried to find something to connect PF_L8 with any DXGI_FORMAT but haven't got any good result. I couldn't find any surface format at DXGI which has 8 bits and it is for luminance there are just for red or alpha channel.

If I tried to change the format of 2D texture creating in Dynamic Texutre sample, I've got multiple visual issues, the dynamic texture (frost.png) was just having buffering issues.

As for the OldTV compositor, the issue also comes from mapping issues, mapping from PF_A8R8G8B8 to any DXGI_FORMAT. In the repo the mapping is to DXGI_FORMAT_UNKNOWN, I've tried to change to other types but without any good result.

If do you have any suggestion, it is more than welcomed :).
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
User avatar
Assaf Raman
OGRE Team Member
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

Post by Assaf Raman »

Good you are continuing.
Make sure to create a public fork for your work and do the work on the right branch (not sure what it is...)
Watch out for my OGRE related tweets here.
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

I have recreated my public fork and it is the same as on my signature :). Also I will work on the 1.9 branch.
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
User avatar
Assaf Raman
OGRE Team Member
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

Post by Assaf Raman »

I am not sure if you should work on the 1.9 branch - as 1.9 is almost out... Will ask other them members to respond - as I am sort of out of touch from personal reasons in the last months (but will be back in touch soon)
Watch out for my OGRE related tweets here.
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

I have pushed to default for now. Ogre3D 1.9 will be out without a fully working DirectX 11 Render System ?
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
User avatar
masterfalcon
OGRE Retired Team Member
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

Post by masterfalcon »

These sound like bug fixes. I'd think they would be ok to put into 1.9.
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

First I will start with bugfixes, and after I will continue with adding some more features :).
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
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 100

Re: DirectX 11 render system - work-in-progress

Post by Wolfmanfx »

@Robert
Create a new for and base your work on 1.9 because everything you did in GSOC went into 1.9 and not default. So make sure you work on the right branch (default is pretty outdated)
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

Ok. I have made up my repository again and committed to the v1-9 branch. Hopefully I will find resolve all the remained problems.
For the color mapping problem I mentioned before, I need some suggestion or ideas if you have :)
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
User avatar
ja0335
Gremlin
Posts: 154
Joined: Sun Jun 07, 2009 9:04 pm
Location: Bogotá, Colombia
x 4

Re: DirectX 11 render system - work-in-progress

Post by ja0335 »

robert_sasu wrote:I have started to work again on the DirectX 11 Render System. ja0335 will help me to resolve all the problems.
In the first part I started to work on the color issues, more specifically OldTV compositor and Dynamic Texture. On the dynamic texture there is a bigger problem as I do not find any DXGI_FORMAT for 8-bit luminance. I have tried to find something to connect PF_L8 with any DXGI_FORMAT but haven't got any good result. I couldn't find any surface format at DXGI which has 8 bits and it is for luminance there are just for red or alpha channel.

If I tried to change the format of 2D texture creating in Dynamic Texutre sample, I've got multiple visual issues, the dynamic texture (frost.png) was just having buffering issues.

As for the OldTV compositor, the issue also comes from mapping issues, mapping from PF_A8R8G8B8 to any DXGI_FORMAT. In the repo the mapping is to DXGI_FORMAT_UNKNOWN, I've tried to change to other types but without any good result.

If do you have any suggestion, it is more than welcomed :).
Hi Robert...

Currently i have my internet acces very slow(can't download source), this is why i cannot test by my self. I think for the 8 bits luminance in DXGI format you can use some BGRA order, like DXGI_FORMAT_B8G8R8A8_UNORM
D3DFMT_A8R8G8B8 is deprecated on D3D11, here are the new maps to DXGI http://msdn.microsoft.com/en-us/library ... re_formats. Please tell me if it works :wink:
Juan Camilo Acosta Arango
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

I have tried your specific suggestion, but it dos not works :( (I have tried it also yesterday.) Microsoft suggests to use DXGI_FORMAT_R8_UNORM and to use .r swizzle in shader to duplicate red to other components to get D3D9 behavior.
I will try this and come back with the result :).
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
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

I have resolved some of the compositor issues, so now Dither, Posterize, Radial blur and Halftone compositors are working. (These were not working). There is still the colouring issue of OldMovie compositor and there are some which are not working: HeatVision, HDR, OldTV, Motion Blur all of them because of shader incompatibilities. We need at least ps_4_0 and vs_4_0.

So I am trying to rewrite and add shaders. And here comes my question: I will past the code I made for OldTV in cg, almost the same as the old one, but I can't compile it at the profile ps_4_0 (using cg toolkit), the only error is some strange one:

Code: Select all

(42) : fatal error C9999: *** exception during compilation ***
41 lines, 2 errors
I have reinstalled my drivers to the newest ones but still the error message appers.

Here is the shader code:

Code: Select all

sampler Image: register(s0);
sampler3D Rand: register(s1);
sampler3D Noise: register(s2);

float4 OldTV_ps4(float2 pos: TEXCOORD1, float2 img: TEXCOORD0,
    uniform float distortionFreq: register(c3),
    uniform float distortionScale: register(c4),
    uniform float distortionRoll: register(c5),
    uniform float interference: 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)

) : COLOR {
   // Define a frame shape
   float f = (1 - pos.x * pos.x) * (1 - pos.y * pos.y);
   float frame = saturate(frameSharpness * (pow(f, frameShape) - frameLimit));

   // Interference ... just a texture filled with rand()
   float4 rand = tex3D(Rand, float3(1.5 * pos, time_0_X));
   rand -= float4(0.2,0.2,0.2,0.2);

   // Some signed noise for the distortion effect
   float4 noisy = tex3D(Noise, float3(0, 0.5 * pos.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(pos.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(pos.y);

   // ... and finally distort
   img.x += distortionScale * noisy.x * dst;
   float4 image = tex2D(Image, img);

   // Combine frame, distorted image and interference
   return frame * (interference * rand.x + image);
}
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
netzlab
Gnoblar
Posts: 23
Joined: Sun Mar 06, 2011 4:23 pm

Re: DirectX 11 render system - work-in-progress

Post by netzlab »

Hey Robert,

you have to specify which sampler type is your image.

So your first line has to be:

Code: Select all

sampler2D Image: register(s0);
Then your program will compile fine.
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

Yes, it truly compiles, but it is not enough for DirectX 11 Render System. After using your suggestion for the same compositors I get Vertex - Pixel shader linkage error. I will just add some new shaders written in hlsl specially for directX 11 Render System and try it 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
User avatar
ja0335
Gremlin
Posts: 154
Joined: Sun Jun 07, 2009 9:04 pm
Location: Bogotá, Colombia
x 4

Re: DirectX 11 render system - work-in-progress

Post by ja0335 »

robert_sasu wrote:Yes, it truly compiles, but it is not enough for DirectX 11 Render System. After using your suggestion for the same compositors I get Vertex - Pixel shader linkage error. I will just add some new shaders written in hlsl specially for directX 11 Render System and try it out :)
Hi Robert...

After a extended reading about d3d11 shaders i conclude is best make your shaders in HLSL.

I was working in the Dynamic Texture sample and resolved that is necessary use a pixel shader because the DXGI_FORMAT_R8_UNORM only returns red channel and to get the texture result good you must set the other channels to the same value comming in the red channel. At the end the pixel shader is just.

Code: Select all

float4 main_ps( v2p input ) : SV_TARGET
{
	float4 l_color0;
	float4 l_color1;
		
	l_color0 = g_frostTexture.Sample(SampleType, input.texCoord);
	
	l_color1 = g_thawTexture.Sample(SampleType, input.texCoord);
	// fill all channels to red value except alpha
	l_color1 = float4( l_color1.rrr, 1.0f);
	
	return l_color0 * l_color1;
}
with this shader the Dyn-Texturing works ok with no color issues, and we may say it is solved.
Image

The problems comes when in a different test, i load a texture in that way :

Code: Select all

			texture_unit
			{
				texture woman.jpg PF_L8
			}
and the result is a bad sampled image:
Image

this is the original image:
Image

I really don't know how may i correct the way the pixel shader is sampling the texture. :( Any Ideas?
Juan Camilo Acosta Arango
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

The problem it is how you use the sample type. I am using:

Code: Select all

SamplerState g_samLinear
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Wrap;
    AddressV = Wrap;
};
Somehow when you are sampling you are duplicating each line probably 3 times. If you can, push your code to the repo, if not I will add to my code and push it later.
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
User avatar
ja0335
Gremlin
Posts: 154
Joined: Sun Jun 07, 2009 9:04 pm
Location: Bogotá, Colombia
x 4

Re: DirectX 11 render system - work-in-progress

Post by ja0335 »

Hi Robert...

I have commited the files Examples-DynTex.material and the new shader Dyn-Tex.hlsl. I have not added support for the other render systems yet.
Juan Camilo Acosta Arango
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

Hi Juan, I do not see any of your commited files in the repo. Can you check it again and push you code ? I will add support to other systems if needed, or just make to load different pixel shader then simply texturing just when using DirectX 11 Render System.

Thanks,
Robert
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
User avatar
ja0335
Gremlin
Posts: 154
Joined: Sun Jun 07, 2009 9:04 pm
Location: Bogotá, Colombia
x 4

Re: DirectX 11 render system - work-in-progress

Post by ja0335 »

Juan Camilo Acosta Arango
User avatar
ja0335
Gremlin
Posts: 154
Joined: Sun Jun 07, 2009 9:04 pm
Location: Bogotá, Colombia
x 4

Re: DirectX 11 render system - work-in-progress

Post by ja0335 »

Today i was working with the Grass Sample, and founded that there is an error in the .material technique selection, i was loked the error before when creating a fallback technique in Dyn-Texture example. The error is simple, when multiple techniques was created, the engine allways select the fallback (the less expensive). this is why the grass have no wave animation and Ogre head haven't normal mapping shader. If i remove the fallback technique the demo runs ok with no problems.

I post the issue here because i don't have idea where is and how works the technique selector, if some one have idea please say me. (Off course i will look the code to find the place)
Juan Camilo Acosta Arango
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

It is nice :) Good job. I will test and try to make further improvements. I had the same problem as you in the last 2 days (I was in an other city with slow internet connection and couldn't clone the repo to my laptop.) In the first days I was working at my jobs office and on a PC.

Please commit everything to the v1-9 branch not to the default one. When you clone it you add the option -r v1-9, and you have to push your code like this hg push --branch v1-9.
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
User avatar
robert_sasu
Google Summer of Code Student
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

Post by robert_sasu »

I have some problems with compiling the source on my laptop. I have to clean up a lot of things as I can't even make the first pass with configuring with CMake. I have an exam on wednesday and friday so I do not know when I will have time to do that. I will give it a try today.
After that I will continue with writing shaders for the DirectX 11 Render System.
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
User avatar
ja0335
Gremlin
Posts: 154
Joined: Sun Jun 07, 2009 9:04 pm
Location: Bogotá, Colombia
x 4

Re: DirectX 11 render system - work-in-progress

Post by ja0335 »

Hi...

I was creating a stand alone app to test individually the demos, but i have figured the render system is giving me an exception when saying me that i need the Vertex Shader and the Pixel Shader, i looked the material scripts in some samples in the browser and figured that they doesn't have the shaders defined but still working. What need i do to have these same behaviour?
Juan Camilo Acosta Arango