Flexible Vertex Format - special SVN branch is ready!!!

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
booe
Posts: 76
Joined: Thu Jul 29, 2010 2:12 pm

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by booe »

serengeor wrote:
Nadro wrote:Bug in a Demo example is fixed. Currently it looks like a FVF implementation is a bugs free.
Reminds me viewtopic.php?f=3&t=34610&start=390#p265751 :lol:
Oh yeaaah, bug-free software is as rare as sheep-free glades! Wooohoooo! Do you know where the sheeps are?

@REDDemon - you're right, big sheeps tend to roll more often.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by mongoose7 »

I have come across a problem with Irrlicht, not specifically your code. I would like Irrlicht to set up a blending mode. To do this, I need to set

Code: Select all

Material.MaterialType = video::EMT_ONETEXTURE_BLEND;
But I am using a shader, so I need

Code: Select all

Material.MaterialType = shader;
Of course, you cannot set the same item to two different values. Are there any plans to address this?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Nadro »

Please use a video::EMT_ONETEXTURE_BLEND as a base material for Your shader.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by mongoose7 »

OK, I see it now. Sorry to have bothered you.

Except, how do you set the blend function?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Nadro »

You can set it in this way:

Code: Select all

node->getMaterial(0).MaterialTypeParam=video::pack_textureBlendFunc(video::EBF_ONE, video::EBF_ONE_MINUS_SRC_ALPHA, video::EMFN_MODULATE_1X, video::EAS_VERTEX_COLOR);
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by mongoose7 »

Ta. :D
Bl00drav3n
Posts: 48
Joined: Sun Apr 22, 2012 11:55 pm
Location: Vienna
Contact:

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Bl00drav3n »

Will this FVF feature (hopefully) make its way into Irrlicht 1.8 or 1.9?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by hybrid »

It's planned for Irrlicht 2.0
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by ACE247 »

Just to ask quickly, can I get sort of a summary of what's been done on the special shader pipeline branch of irrlicht allready?
As in can the SVN of the shader branch maybe have a separate changes.txt file to show only the changes made in the svn branch, for readability reasons?
Would be nice to know what's going on in there. :)
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Nadro »

Special changes.txt is a good idea I think. Currently only FVF support is done.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by ACE247 »

Ok cool. I thought parts of the OpenGL 3.x driver you once proposed was also partly in there already.
I have no doubt its also going to go in there soon. :)
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Nadro »

I tried add partially support for OGL3 in april, but I'm finishing my game (small 2D game based on Irrlicht, which will be available soon) and currently I don't have too much time, but I think that in may we'll have basic support for this driver in Irrlicht :)
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by devsh »

my two cents on the whole irrlicht OGL thing - assume version 2.1 lowest compatibility, and 3.0 hopefully

this is because Intel have appalling drivers, which often on dx10 feature set cards report OGL 2.1 or OGL 3.0 but without many of the features and extensions


my two cents on flexible vertex formats:

irrlicht needs to do either of the two:

1) you need an array of (stringc name, binding) to pass to the GPU services when it compiles/adds your shader so you can tell openGL to bind the vertex attributes in the shader to slots from flexible vertex formats
2) you need to make irrlicht parse the vertex shader when Driver->version<300 (or GLSL version lower than 1.50) and find "layout(location = X) in genType variable;" and swap that for "attribute genType variable" and tell openGL to bind the vertex attributes in the shader to slots from flexible vertex formats

In my opinion APPROACH 2 is really nice



Then obviously it would be nice to have an interface for removing shaders/material renderers as irrlicht does not have one yet :D


Then its just a matter of sorting out the IMeshBuffer container to support the definitions of the layouts of the vertex data

USEFUL stuff to note:

1) Tell people how to make the compiler not force alignment of Vertices by padding
2) Support the full range of data types (byte,short,float,int and their unsigned counterparts)
3) Enable one to specify in the mesh buffer how these map to slots, how many components in the slot... etc.
4) Enable one to specify in the mesh buffer if the variables should be normalized (ints be converted to floats but then scaled to the [-1,1] range)
5) Enable one to specify if vertex attributes are interleaved or in separate arrays
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Granyte »

the current d3d FVF driver never compile user made description
so I took this

Code: Select all

void CD3D9Driver::setVertexDeclaration(IVertexDescriptor* vertexDescriptor)
{
    if(LastVertexDescriptor != vertexDescriptor)
    {
        u32 ID = 0;
 
        for(u32 i = 0; i < VertexDescriptor.size(); ++i)
        {
            if(vertexDescriptor == VertexDescriptor[i])
            {
                ID = i;
                LastVertexDescriptor = VertexDescriptor[ID];
                break;
            }
 
        }
 
        HRESULT hr = pID3DDevice->SetVertexDeclaration(VertexDeclaration[ID]);
 
        if (FAILED(hr))
        {
            os::Printer::log("Could not set vertex declaration.", ELL_ERROR);
            return;
        }
    }
}
and changed it like this

Code: Select all

void CD3D9Driver::setVertexDeclaration(IVertexDescriptor* vertexDescriptor)
{
    if(LastVertexDescriptor != vertexDescriptor)
    {
        u32 ID = 0;
 
        for(u32 i = 0; i < VertexDescriptor.size(); ++i)
        {
            if(vertexDescriptor == VertexDescriptor[i])
            {
                ID = i;
                LastVertexDescriptor = VertexDescriptor[ID];
                break;
            }
            else if(i==VertexDescriptor.size()-1)
            {
                this->addD3DVertexDescriptor(vertexDescriptor);
            }
 
        }
 
        HRESULT hr = pID3DDevice->SetVertexDeclaration(VertexDeclaration[ID]);
 
        if (FAILED(hr))
        {
            os::Printer::log("Could not set vertex declaration.", ELL_ERROR);
            return;
        }
    }
}

found this after messing around my instancing patch for an hour wondering why it was not working
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Flexible Vertex Format - special SVN branch is ready!!!

Post by Nadro »

You're right. It looks like a bug. In D3D9 we should remove addD3DVertexDescriptor and use similar solution to OpenGL vertex descriptor - derived class CVertexDescriptor_d3d9 and override addVertexDescriptor method in CD3D9Driver class. At now interface isn't unified. I'll add it on my TO-DO list, anyway as temp solution your patch is good, because it solve problem from end user point of view.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Post Reply