Skip to main content
gamedev.net
🔒 Locked

.fx Problems

Started by m4gnus 1 reply 350+ views
Original Post
m4gnus
m4gnus
Hi Recently i started implemented all the material stuff(the actual material class but also a renderer class for sorting the meshes based on the material applied on them)in my engine. Now the actual rendering works and it also renders with a .fx file but i get strange results with em: At first glance this looks ok but the Plane and the Cube actually have the same material and the cube is in front of the Plane(!). I'm rendering both meshes with this effect file: STRING Description = "Alpha-Blending"; STRING BackgroundImage = "Background.jpg"; STRING TextureFilename1 = "Stone.jpg"; STRING ModelFilename = "Sphere.x"; TEXTURE tex0; TECHNIQUE T1 { PASS P1 { MaterialDiffuse = {1.0f, 1.0f, 1.0f, 1.0f}; MaterialAmbient = {0.5f, 0.5f, 0.5f, 0.0f}; MaterialSpecular = {0.0f, 0.0f, 1.0f, 0.0f}; MaterialEmissive = {0.0f, 0.0f, 0.0f, 0.0f}; MaterialPower = 10.0f; SpecularEnable = True; Texture[0] = <tex0>; AlphaBlendEnable = True; SrcBlend = SrcColor; DestBlend = InvSrcColor; CullMode = CW; ZWriteEnable = False; } PASS P2 { CullMode = CCW; } } for other effect files i even get stranger results..i.e with a wireframe effect it still renders everything in solid mode.. I have no idea where these errors come from. Can anybody tell me where the problem could be? EDIT: oops this should go to the DirectX forum :/ if a moderator reads this plz move the thread regards, m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."
wasd
wasd
Just looked at it quickly, but you're turning off Z write and not turning it back on (unless it's being turned on elsewhere), so there's no z buffering, which is why the plane looks like it's in front of the cube.
m4gnus
m4gnus
it is turned on again because i pass 0 as the second parameter to the effect->begin() function. that means that directx saves the renderstates before the rendering with the effect and restores them after rendering.

regards,
m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.