Page 3 of 6

Posted: Thu Mar 17, 2005 6:26 am
by ZDimitor
I got it

Posted: Thu Mar 17, 2005 7:43 am
by ZDimitor
Well, I found a bug in Irrlicht 0.8 (in OpenGL driver)!
It appears when you are using in the same scene EMT_LIGHTMAP and EMT_TRANSPARENT_VERTEX_ALPHA materials. In this case diffuse texture simply disappearing.

This bug not appears in Irrlicht 0.7, so to eliminate it from Irrlicht 0.8 you must simply replace function OnSetMaterial in class COpenGLMaterialRenderer_TRANSPARENT_VERTEX_ALPHA (in file COpenGLMaterialRenderer.h).

Copy this function from Irrlicht 0.7 and paste it into Irrlicht 0.8, and recompile all.
Thats all - the bug must be eliminated after this.

Posted: Thu Mar 17, 2005 9:33 am
by Testur
afecelis wrote:thnx for replying Testur.

then what would the shadows map be used for?
Beats me, all it does is render the direct shadows caused by object, since the ligthingmaps have that plus all the shading there's no real need to use it.

Or as Zdimitor said, Forget about them. :)

Posted: Thu Mar 17, 2005 10:46 am
by ZDimitor
I upload new version of My3DTools (3.11) on my site
http://my3dproject.nm.ru/

Changes:
1) Add new method to Loader, getChildNodes(), to getting access to the nodes (with transparent material), creating while loading .my3d file
2) Made some changes in My3D Example

2Afecelis and 2All:
Use new method (see example), to set Parent to the transparent child nodes in .my3d scene.
After that elements that have a level of opacity must show up at the places where they're supposed to be.

2Afecelis:
Try now you scene.

Good luck programmers! 8)

Posted: Thu Mar 17, 2005 11:32 am
by etcaptor
Must I have to replace OnSetMaterial fuction with v 0.7 in this case?

Posted: Thu Mar 17, 2005 12:26 pm
by afecelis
whoa Zdimitor, you're fast!!!

Many thanks for all the help. Gonna try the fixes right away!!!

:D

Posted: Thu Mar 17, 2005 1:34 pm
by ZDimitor
Its a bug in Irrlicht 0.8 so we must patch it:

Irrlicht 0.7 source:
Open file COpenGLMaterialRenderer.h in Irrlicht 0.7, find declaration
of the class COpenGLMaterialRenderer_TRANSPARENT_VERTEX_ALPHA, find function
OnSetMaterial, it looks like this:

Code: Select all

    virtual void OnSetMaterial(SMaterial& material, const SMaterial& lastMaterial,
        bool resetAllRenderstates, IMaterialRendererServices* services) 
    {
        if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
        {
            glDisable(GL_ALPHA_TEST); 

            Driver->setTexture(1,0);

            if (Driver->hasMultiTextureExtension())
                Driver->extGlActiveTextureARB(GL_TEXTURE0_ARB);

            glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
            glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
            glEnable(GL_BLEND);
        }

        material.ZWriteEnable = false;
        services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
    }
Copy it in buffer

Irrlicht 0.8 source:
Open file COpenGLMaterialRenderer.h in Irrlicht 0.8, find declaration
of the class COpenGLMaterialRenderer_TRANSPARENT_VERTEX_ALPHA, find function
OnSetMaterial, it looks like this:

Code: Select all

    virtual void OnSetMaterial(SMaterial& material, const SMaterial& lastMaterial,
        bool resetAllRenderstates, IMaterialRendererServices* services) 
    {
        if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
        {
            glDisable(GL_ALPHA_TEST); 

            Driver->setTexture(1,0);

            if (Driver->hasMultiTextureExtension())
                Driver->extGlActiveTextureARB(GL_TEXTURE0_ARB);

            glDisable(GL_ALPHA_TEST);

            glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);

            glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
            glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PRIMARY_COLOR_EXT);

            glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
            glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PRIMARY_COLOR_EXT);
            glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
            
            glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
            glEnable(GL_BLEND);
        }

        material.ZWriteEnable = false;
        services->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
    }
Comment or delete it and paste the text from buffer.
After this you must recompile Irrlicht 0.8 and use new Irrlich.dll and Irrlich.lib in your project.

Thats all.

Posted: Thu Mar 17, 2005 1:45 pm
by ZDimitor
I think we should ask niko to fix this bug , it appear when you are using in the same scene EMT_LIGHTMAP and EMT_TRANSPARENT_VERTEX_ALPHA materials. In this case diffuse texture simply disappearing.

I am already post about this in Bug report.

Posted: Thu Mar 17, 2005 1:52 pm
by afecelis
thnx for the elaborated explanation, I also agree we should report niko about it.

Ok guys, new version of My3d tools (3.11) mirrored here:
http://www.danielpatton.com/afecelis/Zd ... binary.zip
http://www.danielpatton.com/afecelis/Zd ... 1.full.zip
http://www.danielpatton.com/afecelis/Zd ... .light.zip

and I tried the new modifications and adding the new child nodes stuff but I'm getting the following errors:

Code: Select all

CMY3DMeshFileLoader.obj : error LNK2019: unresolved external symbol "class irr::ILogger * logger" (?logger@@3PAVILogger@irr@@A) referenced in function "public: virtual class irr::scene::IAnimatedMesh * __thiscall irr::scene::CMY3DMeshFileLoader::createMesh(class irr::io::IReadFile *)" (?createMesh@CMY3DMeshFileLoader@scene@irr@@UAEPAVIAnimatedMesh@23@PAVIReadFile@io@3@@Z)
LIBC.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
C:\Irrlicht\Projects_Relo\Laguito\laguito.exe : fatal error LNK1120: 2 unresolved externals

I'm checking what's wrong now, but any shortcut help will be appreciated!! :D

Posted: Thu Mar 17, 2005 1:57 pm
by ZDimitor
Try My3D example. Is it works for you?

It looks like you forget about global declaration in main.cpp

ILogger* logger;

Posted: Thu Mar 17, 2005 4:51 pm
by afecelis
nope, it's there

still trying, gonna check your examle

Posted: Thu Mar 17, 2005 5:08 pm
by afecelis
Ok, I used your main file and modify it and now it compiles ok. But I still got to fix the opengl renderer but I can't find any of the lines you mention in COpenGLShaderMaterialRenderer.h

meanwhile I'm going to try it with DX!

thnx for the help! :D

Posted: Thu Mar 17, 2005 5:54 pm
by afecelis
Great! transparent meshes are showing up where they're supposed to :D

last bug to fix is th eopengl issue.

Posted: Fri Mar 18, 2005 1:06 am
by ZDimitor
Damn it! Small mistake in my post (fix OpenGL bug), the file to be corrected
COpenGLMaterialRenderer.h

I correct this posts now.

Posted: Fri Mar 18, 2005 1:23 am
by afecelis
hehehehe, small mistake, huh?

It fixed it!! yay hooray :D :D Opengl looks damn nice!!

Image


many thnx for all the help Dmitri!!

final question; why is my water showing up greenish? any ideas?