Finally, a DirectX 10 video driver for Irrlicht

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Nadro »

OK, so I'll wait for your changes. I'll be nice to prepare working version in shader-pipeline branch, in future it will make dev process easier :)

I think that we should prepare CD3D11MaterialRenderer structures in this way:
1. CD3D11ShaderMaterialRenderer - This material is unnecessary, because all materials in D3D11 are HLSL based.
2. CD3D11MaterialRenderer - Mix between how OGLES2 driver looks and OGL in trunk, so we can put to this material object called CD3D11FixedPipelineShader (look how OGLES2 driver looks in this place we need something similar). Derived materials eg. CD3D11MaterialRenderer_SOLID etc. should look like COpenGLMaterialRenderer_SOLID
from trunk so, we have in them following methods:

Code: Select all

virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, bool resetAllRenderstates, IMaterialRendererServices* services) -> here we call methods from CD3D11FixedPipelineShader.
virtual void OnSetBaseMaterial(const SMaterial& material) -> here we set driver states eg. turn on blending, without calls from CD3D11FixedPipelineShader.
virtual void OnUnsetMaterial() -> Similar to situation from OnSetMaterial.
virtual void OnUnsetBaseMaterial() -> Similar to sitouation from OnSetBaseMaterial.
3. CD3D11ParallaxMapRenderer and CD3D11NormalMapRenderer - similar to files in D3D9, so without effects and just with predefined IShaderConstantSetCallback for sending uniforms, these classes should derived from CD3D11HLSLMaterialRenderer instead of CD3D11ShaderMaterialRenderer. From driver code this files should create standard CD3D11HLSLMaterialRenderer like end user can do, but shader files and callback should built-in Irrlicht.
4. CD3D11HLSLMaterialRenderer structure of this file should look similar to COpenGLSLMaterialRenderer from trunk.

This organization will allow us to unified D3D11 driver to others built-in Irrlicht drivers (in the same way I'll develop OGL3 driver).

BTW. Will be nice to use the same variable names as in other drivers. In D3D11 I saw somewhere BaseRenderer (undefined from compiler perspective). I think that it was BaseMaterial (IMaterialRenderer)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

ok i will change that tomorrow.

i made a little patch against the lastest branch rev to fix all issues with the dx11 driver that we got after we merged the revs. so the driver will work again.

dx11fix.patch

only the skybox is broken not sure what this caused.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Nadro »

You did a lot of clean up of code, thanks for this patch! :)

I noticed following issues in examples:
08 - No shadow, volumetric light and reflections on the water
10 - No alpha transparent box
11 - No color textures when normal/parallax map is enable.

Skybox issues are related to our FVF<->DX11 stuff I think.

This version looks really nice! I uploaded all changes on SVN.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

08 - No shadow, volumetric light and reflections on the water
yes this are just missing features
10 - No alpha transparent box
i guess thats a shader error because if you change the cam pos the box will appear.

11 - No color textures when normal/parallax map is enable.
this is also a shader error i guess a normalisation is somewhere missing but i m not a shader pro:/
Skybox issues are related to our FVF<->DX11 stuff I think.
yes maybe. i noticed that if you changed the culling mode from back to front the otherside of the skyboxside is drawn. so the last triangle of the side is the wrong way.
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Granyte »

I cannot test it but as far as i know the error for 11 is cause because i cut the rendering of them when i was devloping the shaders

for the 10 it'S related to a depth sorting issue cause if you position your self the right way you will notice the box turn into a environement pass through

for the 8 shadows are not yet implemented the reflexion shader is still in devlopement


EDIT: I just downloaded the shaderpipeline branch and i have the iHardware file missing as well as the svertex element

also the color issue can be fixed in these shader by changin color to color.bgra how ever the light atenuation code is just not working and i'm unable to fix that
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

oh i guess i forgot to add them to the patch...
i will provide them tomorrow.
meanwhile you can take them from a old patch or old version. I changed nothing in the files
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Nadro »

Currently I'm developing OGLES2 driver (similar to DX11 this driver has fully programmable pipeline). I rewrite many parts of this driver and here You can find a patch for current ogl-es branch (source folder part).
http://www.sendspace.com/file/zz8nb9
I think that for DX11 we should use similar class organisation, so:
At left current classes structure, at right OGLES2 classes structure
CD3D11MaterialRenderer -> removed (this file in orginal structure isn't important for programmable pipeline driver)
CD3D11HLSLMaterialRenderer -> CD3D11MaterialRenderer (all renderers use this class as base, this is default renderer thats why we should remove HLSL part from a name)
CD3D11FixedPipelineRenderer -> CD3D11FixedPipelineRenderer (derive from CD3D11MaterialRenderer)
CD3D11NormalMapRenderer -> CD3D11NormalMapRenderer (derive from CD3D11MaterialRenderer)
CD3D11ParallaxMapRenderer -> CD3D11ParallaxMapRenderer (derive from CD3D11MaterialRenderer)
As You can see with this classes structure we removed all fixed pipeline overhead, currently E_MATERIAL_TYPE flag just inform about enable/disable blending for active material and rendering mode for fixed pipeline shader. If You need more info in this case please just ask me.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Nadro »

In the latest svn branch related to ogl-es, You can find a final materials structure (inheritance and materials relations are done) for OGL ES2. Only callback/onrender stuff for normalmap, parallaxmap and fixed pipeline is missing. 2D material renderer and stencil shadows renderer will be created in similar way.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

thx i will look at this.

currently i already changed the structure. i also removed the effect framework. both need little more work. i guess i can do that at weekend not sure.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Nadro »

Good info (removed effect framework was very important). If You will have some patch please send it to me and I'll apply it to svn.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

hi,

i finally found time to improve the dx driver.

here is the patch against the lastest rev:
dx11_update.patch

changes:
+ added IHardwareBuffer.h and SVertexElement.h
+ fixed 3 memory leaks in IMeshManipulator.h
+ fixed parallax und normal map shader
+ added support for compute, hull and domain shaders (theoretically, you have to change the constructor of MaterialRenderer and pass this code through the init function there)
+ removed all warnings from the shaders
+ renamed files to follow ogles name scheme
+ removed Effect Framework
+ added implementation of CMeshManipulator::createForsythOptimizedMesh, Nulldriver::draw3DLine
+ opimized Nulldriver::draw3DBox, CNullDriver::draw2DRectangleOutline, CNullDriver::drawMeshBufferNormals

FixedFunction currently only supports EVT_STANDARD because i m not sure how to add this.
i tried it that way:

Code: Select all

float4 mainPS( PS_INPUT input ) : SV_Target
{
    float4 output = float4(0,0,0,0);
        
    switch( vtxType )
    {
    case EVT_STANDARD:
        output = standardPS(input);
        break;
//  case EVT_2TCOORDS:
//          output = coords2TPS(input);
//      break;
//  case EVT_TANGENTS:
//      output = tangentsPS(input);
//      break;
        };
        
    return output;
};
 
but the problem here is that eg coords2TPS needs a other input struct.
is there a possibility to pass a void* through the mainPS and then cast it to the right structure in the right case?

ps: i also uploaded a patch for irrlicht trunk for the last optimations here:
http://sourceforge.net/tracker/?func=de ... tid=540678

regards
zerochen
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Granyte »

now we need to have 3 fixed function compiled and switch between them depending on the vertex passed that is what the effect framework was simplifying.

Also my dev machine is dead for good i have no idea when I'll be able to help again
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

ah ok. if that is the right way i will implement it the next days. that would be no problem.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by Nadro »

Great stuff :) Thanks for a patch. I'll apply it to the branch today.

What about support fixed vertex formats Granyte is right. You can check how it's done in fixed pipeline drivers eg. software drivers or d3d8. Of course in future in d3d11 we'll replace this system by flexible vertex format solution.

Update:
I applied Your patch to the branch, but many examples doesn't work now eg. 02 and 10. In example no. 11 diffuse also doesn't work.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
zerochen
Posts: 273
Joined: Wed Jan 07, 2009 1:17 am
Location: Germany

Re: Finally, a DirectX 10 video driver for Irrlicht

Post by zerochen »

ok added support for the other vtxTypes.

update.patch

i guess the skybox is broken because dx11 doesnt support triangle fans anymore.
so can we (or i) change that to triangle stripes? i think it doesnt decr performance because both are n+2 (n = primCount)

whats the standard behavior to handle more than one shader? eg fog from fixedfunctionshader and parallax thing?

regards
zerochen
Last edited by zerochen on Mon Feb 04, 2013 5:32 pm, edited 3 times in total.
Post Reply