Mapping Objects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
LunaRebirth
Posts: 385
Joined: Sun May 11, 2014 12:13 am

Re: Mapping Objects

Post by LunaRebirth »

hendu wrote:Note that irr by default has materials in the node, and your latest function modifies the mesh's materials instead.

Try changing
obj->getMesh()->getMeshBuffer(x)->getMaterial()
to
obj->getMaterial(x)
Great!! That worked. Here's the final part to the water:

Code: Select all

void changeObject(IAnimatedMeshSceneNode* &obj) {
    ITexture* myT = driver->getTexture("media/Locations/KokiriForest/water.png");
    for (int x=0; x<obj->getMesh()->getMeshBufferCount(); x++) {
        for (int y=0; y<100; y++) {
            if (obj->getMaterial(x).getTexture(y)==myT) {
                obj->getMaterial(x).MaterialType=EMT_TRANSPARENT_ADD_COLOR;
            }
        }
    }
}
I've found that it's TRANSPARENT_ADD_COLOR that I want for the opacity.

Next is the trail.
Would you maybe have more pseudo-code I could look into coding?
Or maybe a link for how to change the trail to merge with the grass.png texture and make it brown?
(There is no dirt.png or anything image, so I assume it's just a color change. I've no idea how it works though!)
I figured it'd maybe be a splattermap, but the path is a separate object inside of the .obj. It's just a platform on top of the grass.

Thanks again for your awesome help!
So glad to get the water transparency working.
I hope the dirt path isn't going to be too difficult.
CuteAlien
Admin
Posts: 9847
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Mapping Objects

Post by CuteAlien »

Hm, only did a quick check. The log from Android looks like it doesn't really load the mtl file - or at least not the textures in it. Because on PC you get lot's of texture-load messages there. But no idea yet why as there should be some errors then. I haven't tried myself yet on Android.

The materials all have the same style - so I suppose they are interpreted later by the program based on something. Maybe on texture-name. The ground-texture looks to me on first view like some texture which is meant to be used with black parts alpha and the rest colored in-game with some (maybe level-dependend) color. IVideoDriver::makeColorKeyTexture might help with the alpha-part. Not sure about easiest way to do coloring. Maybe simplest way is just do modify texture in a painting tooĺ so they are no longer white but have the color you want (that looks like some memory-saving trick done for console).

Could be the texture names are also hints - for example many textures end in 'a' - that could mean to use some specific alpha style for those (just guessing).

There's also some serious z-fighting going on here, so either camera planes need to be modified or some other workkarounds (hendu mentioned splatmap). Easiest trick might be increasing y values for corresponding meshbuffer-values by some epsilon value (so road flies a little bit).

Maybe I can check Android over the week to see if there is some problem, but probably not (too much todo's already for this week).
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
Post Reply