Jump to content

  • Log In with Google      Sign In   
  • Create Account

NightcrawlerEX

Member Since 25 Jan 2013
Offline Last Active Mar 18 2013 02:00 AM

Topics I've Started

Calling directx10 effect->settexture redundantly

09 February 2013 - 09:47 PM

I am using multiple calls to drawindexed for a single model to draw submeshes and some of the meshes have the same texture but different material stats etc.

When i call settexture is there an internal check directx does to see if i am setting the same texture again or does it benefit me to check myself?

E.g.

For(submeshes)
{
Settexture()
Otherstuff()
Draw()
}

Compared to

For(submeshes)
{
If(!textureissame) settexture()
Otherstuff()
Draw()
}

Per face materials

04 February 2013 - 02:43 AM

Hi all,

I have been looking through a directx x file exporter and have realised that it exports materials in a way different than i am used to. I am used to assigning a 1 material per object and when it comes to the shader, just passing in the material to be used.

The way this exporter does it is by first outputting each material to be used, then outputting a set of per face indices to the relevant materials.

I was wondering if anyone knew how to go about this, or possibly a link to some texts regarding this?

Also is there a way to tell which face you are working on during the pixel shader? This would be good for many reasons but i dont think this is likely

[EDIT] so far my train of though is sorting all the faces per material into seperate objects

Blender to Directx exporter... works, but i think its too hacky

25 January 2013 - 09:18 AM

Hi all,

 

I have been working on a simple model exporter and have been having proplems with my UV coordinates.

 

When i exported from blender a textured cube the texture would not map properly. After a small search I realised that this was beacuse blender stores UV coordinates in relation to the the origin being at the bottom left and directx uses the top left. I then edited my exporter by changing...


V = V

 

to

 

V = 1 - V

 

This sort of worked but it ended up with the textures being displayed backwards....

 

Attached File  001.png   14.62KB   25 downloads

 

 

 

I then started reading through a directx exporter I found that it used some code to turn triangles backward (vertindex = vertindex[::-1])

e.g.

vert1 = 3 

vert2 = 2

vert3 = 1

 

so I gave that a try to see how it affected everything and it yeilded this result...

 

Attached File  002.png   15.52KB   28 downloads

 

so I changed the rasterizer settings to cull the front of triangles and display the back...

 

Attached File  003.png   14.47KB   21 downloads

 

This worked!

But I can't help feeling that this is the wrong way to do things.

 

Am I missing a more simple, less hacky way to do things here?

 

does it by chance have anything to do with the fact that blender uses different XYZ coordinates to directx

[Blender]

X = left/right

Y = forward/back

Z = up/down

 

[DirectX]

X = left/right

Y = up/down

Z = foward/back

 

 

Any help would be greatly appreciated, I think it is something I am doing wrong beacuse anything I have read so far on this topic has ended with the answer simply being to invert the V coord. This does not work for me so I assume that I am doing something fundementally wrong

 

btw here is my texture...

 

Attached File  004.png   3.41KB   28 downloads


PARTNERS