Nice update in trunk today

Discussion about everything. New games, 3d math, development tips...
Post Reply
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Nice update in trunk today

Post by thanhle »

Great update in trunk today.
Looks like transparent object correctly displays without z sorting issue when camera moves/rotate

Image

Even deferred render receive some lights.
But not sure why transparent is too much transparent. Even alpha is set to 254. Maybe I did it wrongly.
I used:

Code: Select all

    IMeshManipulator *manip = device->getSceneManager()->getMeshManipulator();
 
for (int j = 0; j < mNode->getMaterialCount(); ++j)
{
     mNode->getMaterial(j).MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
      for (int k = 0; k < mNode->getMesh()->getMeshBufferCount(); ++k)
      {
            manip->setVertexColorAlpha(mNode->getMesh()->getMeshBuffer(k), value);
      }
}
Any suggestion of how I can make transparent work correctly?

Thanks
thanh
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Nice update in trunk today

Post by CuteAlien »

Does it change at all when you change the alpha value?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Nice update in trunk today

Post by ent1ty »

This is a bug in irrRenderer, I think - are you using the "update" branch from my git repo? Transparent materials are still broken :)
I have seen a similar thing myself, however I haven't fixed it yet.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: Nice update in trunk today

Post by thanhle »

Yes it does go lighter as alpha becomes smaller.
But there is a big alpha change between 255 and 254.

Regards
thanh
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: Nice update in trunk today

Post by thanhle »

@ent1ty
Yup! your updated branch : ). With slightly changed to the flags.

void scene::ILightManagerCustom::OnPreRender(core::array<ISceneNode*> &lightList)
{
Device->getVideoDriver()->setRenderTarget(RenderTarget, RenderIndices, true, true, false);// , video::SColor(255, 255, 0, 0));
}


void scene::ILightManagerCustom::OnRenderPassPostRender(scene::E_SCENE_NODE_RENDER_PASS renderPass)
{
if (renderPass == scene::ESNRP_SOLID)
{
Device->getVideoDriver()->setRenderTarget(0, 0, true, false, false, 0);
deferred();
Device->getVideoDriver()->setRenderTarget(RenderTarget, RenderIndices, false, false, false, 0);

}
else if (renderPass == scene::ESNRP_TRANSPARENT)
{
Device->getVideoDriver()->setRenderTarget(0, 0, false, false, false, 0);
deferred();
}
}


I see, but from my my test, transparent object does receive the light.
Only just that it is too much alpha transparent : ).

Regards
thanh
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Nice update in trunk today

Post by ent1ty »

Well, yes, that is what I meant by 'broken' :D
It is not, in fact, an updated branch, but rather a work in progress 'update' you're not really meant to use :P But I'm hoping to fix the transparent materials and merge into master soon-ish :)
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: Nice update in trunk today

Post by thanhle »

Hehe, I can't wait to use it.

Because I need to somehow trying to fix the directional light issue.As the light dims and also at some angle it turns off. There is clearly issue with the dot product at 90 degree as light = 0.
I think since we have the ambient separately, directional light shader would only work with diffuse component.

Regards
thanh
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: Nice update in trunk today

Post by chronologicaldot »

Hurray!!
But - do partially-transparent textures work? For me, it seems it's only transparent when the texture is fully transparent.
Post Reply