University of Southern CaliforniaUSC
USC ICT TwitterUSC ICT FacebookUSC ICT YouTube

A horizontal span of certain object is displayed when I wrote this code | General SmartBody Discussion | Forum

Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
A horizontal span of certain object is displayed when I wrote this code
November 9, 2015
5:26 am
Avatar
Member
Members
Forum Posts: 28
Member Since:
November 5, 2015
sp_UserOfflineSmall Offline

Hello Ari,

The original question was the object was loaded as a horizontal span of thing.

But it has been resolved.

Now, the problem is

Looks like the program is loading some textures many times over.

Could you please show me the correct way to load textures?

Thanks

Jack

int numMeshes =  m->getNumMeshes();

 for (int nm = 0; nm < numMeshes; nm++)
 {
        SrModel model = m->getStaticModel(nm);            

        SbmSubMesh* subMesh = m->subMeshList[nm];        

       std::vector verts;            

        for (int i = 0; i < model.V.size(); i++) {
            SrPnt pt = model.V.get(i);
            SrPnt2 textureCoords = model.T.get(i);                         
            D3DVertex::VertexPositionTexture newPt(pt.x, pt.z, pt.y, textureCoords.x, textureCoords.y);
            verts.push_back(newPt);              
        }

        std::vector inds;
        for (int i = 0; i < model.F.size(); i++)
        {
            inds.push_back(model.F.get(i).a);
            inds.push_back(model.F.get(i).c);
            inds.push_back(model.F.get(i).b);
        }
        D3DXVECTOR3 position = D3DXVECTOR3(model._translation.x, model._translation.y, model._translation.z);
        D3DXVECTOR3 rotation = D3DXVECTOR3(model._rotation.x, model._rotation.y, model._rotation.z);
        D3DXVECTOR3 scale = D3DXVECTOR3(model._scale, model._scale, model._scale);

        D3DSubMesh *smesh = new D3DSubMesh(verts, inds, position, rotation, scale, subMesh->texName);

        smesh->Initialize(m_pDevice3D);

        subMeshes.push_back(smesh);
    }

 

November 9, 2015
5:41 pm
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

You can look in: core/smartbody/SmartBody/src/sr/sr_gl_render_funcs.cpp in the render_model() function for some example code of how to render textures.

 

Ari

November 10, 2015
6:36 am
Avatar
Member
Members
Forum Posts: 28
Member Since:
November 5, 2015
sp_UserOfflineSmall Offline

Okay,

I notice the textures and triBufs are unique to each submesh,

But vertices and texture coordinates aren't

So it renders okay with only the hands white.

I think it is failing to load one of the textures.

Other parts are okay except for the hands

Do you store the hand textures in separate directory?

http://tinypic.com/view.php?pi.....9&s=9

Thanks

Jack

November 11, 2015
12:00 am
Avatar
Admin
Forum Posts: 980
Member Since:
December 1, 2011
sp_UserOfflineSmall Offline

There's a file: ChrBrad_Hands_Dif.png in the same folder as the other textures.

Your rendering looks a bit strange; are you only rendering the diffuse textures (those with a _Dif at the end)? There are also normal maps (_Nrm) and specular maps (_Spc)

 

Ari

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 733

Currently Online: mondayneedle1, huberdavidsen3, casey29english, andersen19eaton, kristensen00leblanc, bager59mayo, eric506784, t9rrzpi307, g2pvwfg490
110 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

jwwalker: 80

jyambao: 51

rbaral: 47

adiaz: 30

WargnierP: 29

lucky7456969: 28

mbarros: 28

avida.matt: 26

JonathanW: 24

laguerre: 23

Member Stats:

Guest Posters: 65

Members: 52460

Moderators: 3

Admins: 4

Forum Stats:

Groups: 1

Forums: 5

Topics: 427

Posts: 2343