vutle / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

Extract/convert lights #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Topic says enough.

Original issue reported on code.google.com by erwin.coumans on 16 Oct 2009 at 7:09

GoogleCodeExporter commented 9 years ago
Here's a patch for converting lights, spot & directional need rotation fix 
though.

Original comment by Phantasm...@gmail.com on 28 Nov 2009 at 11:29

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Thanks for the patch, I'll look into it.

More info about data conversion in Blender/BGE can be found in 
blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp:
http://tinyurl.com/ye6f2qs

For the lights, see KX_LightObject *gamelight_from_blamp

Original comment by erwin.coumans on 29 Nov 2009 at 6:03

GoogleCodeExporter commented 9 years ago
I've fixed spot and directional now.

Original comment by Phantasm...@gmail.com on 29 Nov 2009 at 10:33

Attachments:

GoogleCodeExporter commented 9 years ago
I get a conflict with latest svn trunk and the patch (because of 
copyright/license 
header). Could you create a patch on latest trunk?

Also, we might want to add some logic that if there is no lights in the scene, 
we add a 
default light in Irrlicht (or disable lighting).

Thanks for the effort!

Original comment by erwin.coumans on 29 Nov 2009 at 5:47

GoogleCodeExporter commented 9 years ago
Alright here is the latest patch:

fixed lighting support
add ambient light when scenes have zero lights
support solid, add, alpha, alpha clip material modes
proper flat/smooth normals extraction

Do you or snailrose have any idea about getting a blender mesh's material?

Original comment by Phantasm...@gmail.com on 30 Nov 2009 at 12:44

Attachments:

GoogleCodeExporter commented 9 years ago

Thanks for the patch, I'll apply it soon.

Sure, what material information do you need?

Original comment by erwin.coumans on 30 Nov 2009 at 5:26

GoogleCodeExporter commented 9 years ago
I just need a valid pointer to the Material(s).

Original comment by Phantasm...@gmail.com on 30 Nov 2009 at 8:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Given a Blender::Mesh* mesh, Blender::Material* material = me->mat;
Note that if there is no material, the me->mat is NULL.

Each face has some index into this material array.
You can find all Material conversion/extraction code in 
BL_BlenderDataConversion.cpp
(http://tinyurl.com/ye6f2qs)

In particular methods ConvertMaterial and BL_ConvertMesh.

Hope that helps,
Erwin

Original comment by erwin.coumans on 30 Nov 2009 at 9:33

GoogleCodeExporter commented 9 years ago
I know that, I even tried porting over give_current_material() and it's 
dependent
functions but I just get a crash at runtime.

Original comment by Phantasm...@gmail.com on 1 Dec 2009 at 3:59

GoogleCodeExporter commented 9 years ago
Can you please update to the latest SVN revision (I made a few fixes), and 
check it 
again?

If you get crashes, please provide a .blend file, and some code snippet, with a 
call 
stack of the crash (and platform/compiler).

Cheers,
Erwin

Original comment by erwin.coumans on 1 Dec 2009 at 4:15

GoogleCodeExporter commented 9 years ago

I just applied your lighting3.txt patch. Thanks for the contribution!
http://code.google.com/p/gamekit/source/detail?r=112

By the way, when porting code from Blender, make sure not to copy and paste 
directly, 
to avoid GPL issues. Of course you are free to learn from the Blender source, 
type it 
again using the GameKit C++ structures etc.

Original comment by erwin.coumans on 1 Dec 2009 at 8:06

GoogleCodeExporter commented 9 years ago
No problem!
My original attempt works with the latest SVN, don't need to port any Blender 
functions!

Original comment by Phantasm...@gmail.com on 1 Dec 2009 at 9:39

GoogleCodeExporter commented 9 years ago

If you have further improvements/patches/feedback, please let us know!

Original comment by erwin.coumans on 4 Dec 2009 at 7:25

GoogleCodeExporter commented 9 years ago
I'm having more pointer troubles, crashing when accessing beyond a material's 
first
mtex unit.

this crashes after the first mtex unit:

if(ma->mtex)
    {
        for(int mi = 0; mi < 18; mi++)
        {
            mtex = ma->mtex[mi];
            if(mtex && mtex->tex)
...

Original comment by Phantasm...@gmail.com on 6 Dec 2009 at 4:33

GoogleCodeExporter commented 9 years ago

There are issues with pointer arrays, right now only the first pointer is 
patched.

This will show up with **mat and MTex* tex[18]

We have ideas to fix this, shouldn't take long.

Original comment by erwin.coumans on 6 Dec 2009 at 5:30

GoogleCodeExporter commented 9 years ago
Charlie fixed it, both for OgreKit and IrrKit (gamekit).

http://code.google.com/p/gamekit/source/detail?r=133
http://code.google.com/p/gamekit/source/detail?r=134

(note that OgreKit already can read multi-materials, Irrlicht version not yet)

Original comment by erwin.coumans on 7 Dec 2009 at 5:25

GoogleCodeExporter commented 9 years ago

Original comment by erwin.coumans on 2 Feb 2010 at 5:02