Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: Where to find blend mode for textures in .3ds export?  (Read 5292 times)

mitomart

  • Newbie
  • *
  • Posts: 2
    • View Profile
Where to find blend mode for textures in .3ds export?
« on: August 10, 2012, 12:22:28 am »

Hi,

I am exporting models into .3ds format and loading them into my rendering engine.  Most models look great, except that any textures with a blend mode of "decal" do not load correctly (my loader never finds a blend mode designation so uses the default "darken" e.g. modulate).  Looking at the .3ds spec and the generated binary files, I don't see the blend mode designation.  Can anyone tell me into which chunk anim8or exports this information?  Any help with this would be appreciated. 

Thanks!
Logged

dwsel

  • Sr. Member
  • ****
  • Posts: 271
    • View Profile
    • Dwsel art
Re: Where to find blend mode for textures in .3ds export?
« Reply #1 on: August 10, 2012, 09:20:58 am »

I think that the parameter is not exported because there might be nothing like that in the specification of *.3ds file format, so it's possibly dependent only on the settings of your render engine. You might try *.obj file format because the *.mtl file supports more optional features. Here's the specification: http://paulbourke.net/dataformats/mtl/ .
Logged

mitomart

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Where to find blend mode for textures in .3ds export?
« Reply #2 on: August 10, 2012, 10:52:42 am »

dwsel:

Thanks for the advice.  As it happens, I have looked at other formats (I noticed that the
native .an8 format exports the setting, for one), but I would prefer to improve my .3ds
loader if possible.  For one thing, I have dozens of models in that format, and it simplifies
things for me to have all of my assets in the same format. 

Also, Anim8or loads the correct texture blend mode for the materials from the exported
.3ds file, so it must be writing that information somewhere in order to correctly render
the model that it exported. 

Poring over the various .3ds specs, there are two potential places where this setting
could get written: 
1.  in a chunk specifically designed for it (0xa082)
2.  in the material flags chunk (0xa351). 

However, according to my loader (and hex editor), these chunks do not appear in the exported file. 

In the end, I may have to add support for other formats (or add the ability to override the texture
blending in my effects definition files), but the stubborn part of me wants to make sure that there
is no better way first. 

Thanks again!
Logged

dwsel

  • Sr. Member
  • ****
  • Posts: 271
    • View Profile
    • Dwsel art
Re: Where to find blend mode for textures in .3ds export?
« Reply #3 on: August 10, 2012, 04:58:27 pm »

You're welcome, it looks that I didn't help much anyway because, you've already researched that topic more thoroughly than I did ;) but one more idea comes to my mind...

Sometimes I saw parameters hidden for example in the names or at the least significant bit in the non standard place. Did you see any mangled letters at the end of the material's name for example? Does Anim8or load correctly the mode only from files exported by itself or also from created by other apps? Is the loader/engine written fully by you or just a closed library?

I assume there's no other quirky place the loader might try to look for the parameter, and you don't have to set the mode explicitly in the engine and the mode is saved somewhere in *.3ds file by Anim8or. Then I'd suggest differential test that should show the location:
- create cube with the material with 'decal' mode
- export to *.3ds
- change mode to 'darken'
- export to *.3ds
- compare files bit by bit

Good luck with finding this flag.
Logged