Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualvinnyhalts

Posted 09 March 2013 - 02:49 PM

Where did you put that line?

Can you post a better screenshot? It's very hard to tell anything from that. We don't know what the object is supposed to look like, so it's hard to tell what's wrong.

How does it look from different angles?
What does the original look like in your modelling program?
Is it really transparent? Can you put something other than a blank background behind it, so it is easy to tell?

 

I put the line right after I set my new render target.

 

        public override void Draw(GameTime gameTime)
        {
            XNAGame.Instance.GraphicsDevice.SetRenderTarget(RT);
            XNAGame.Instance.GraphicsDevice.Clear(Color.Transparent);
            XNAGame.Instance.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    //part.Effect = e;
                    e.Parameters["World"].SetValue(transforms[mesh.ParentBone.Index] * Matrix.Identity);
                    e.Parameters["View"].SetValue(Matrix.Identity);
                    e.Parameters["LightDirection"].SetValue(Vector3.Normalize(Skydome.Instance.sunDir));
                    e.Parameters["CameraPosition"].SetValue(XNAGame.Instance.Camera.Position);
                    e.Parameters["Projection"].SetValue(Matrix.Identity);
                    e.Parameters["ColorMap"].SetValue(diff);
                    e.Parameters["NormalMap"].SetValue(norm);
                    e.Parameters["SpecularMap"].SetValue(spec);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                }
                mesh.Draw();
            }
            RtTex = RT;
            XNAGame.Instance.GraphicsDevice.SetRenderTarget(null);
            
            //Stream str = File.OpenWrite("Dump.png") ;
            //RtTex.SaveAsPng(str, RtTex.Width, RtTex.Height);
            //str.Close();
        }
    }

 

 

Here is a photo of the gun in game, without using a different render target.

 

2l7ic9H.jpg

Is your camera positions such that it is inside the camera?  This would make you only see faces that are pointing towards the camera even though it is inside, meaning that there would be lots of faces culled out by back face culling.

 

I've tested it with other models and tried moving the model further away. Nothing seems to work.

 

 

 

 

Edit: I added more photos to show the problem.

 

HP58uoM.png


#2vinnyhalts

Posted 08 March 2013 - 12:34 AM

Where did you put that line?

Can you post a better screenshot? It's very hard to tell anything from that. We don't know what the object is supposed to look like, so it's hard to tell what's wrong.

How does it look from different angles?
What does the original look like in your modelling program?
Is it really transparent? Can you put something other than a blank background behind it, so it is easy to tell?

 

I put the line right after I set my new render target.

 

        public override void Draw(GameTime gameTime)
        {
            XNAGame.Instance.GraphicsDevice.SetRenderTarget(RT);
            XNAGame.Instance.GraphicsDevice.Clear(Color.Transparent);
            XNAGame.Instance.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    //part.Effect = e;
                    e.Parameters["World"].SetValue(transforms[mesh.ParentBone.Index] * Matrix.Identity);
                    e.Parameters["View"].SetValue(Matrix.Identity);
                    e.Parameters["LightDirection"].SetValue(Vector3.Normalize(Skydome.Instance.sunDir));
                    e.Parameters["CameraPosition"].SetValue(XNAGame.Instance.Camera.Position);
                    e.Parameters["Projection"].SetValue(Matrix.Identity);
                    e.Parameters["ColorMap"].SetValue(diff);
                    e.Parameters["NormalMap"].SetValue(norm);
                    e.Parameters["SpecularMap"].SetValue(spec);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                }
                mesh.Draw();
            }
            RtTex = RT;
            XNAGame.Instance.GraphicsDevice.SetRenderTarget(null);
            
            //Stream str = File.OpenWrite("Dump.png") ;
            //RtTex.SaveAsPng(str, RtTex.Width, RtTex.Height);
            //str.Close();
        }
    }

 

 

Here is a photo of the gun in game, without using a different render target.

 

2l7ic9H.jpg

Is your camera positions such that it is inside the camera?  This would make you only see faces that are pointing towards the camera even though it is inside, meaning that there would be lots of faces culled out by back face culling.

 

I've tested it with other models and tried moving the model further away. Nothing seems to work.

 

 

 

 

Edit: I added more photos to show the problem.

 

0pbgSES.jpgHP58uoM.png


#1vinnyhalts

Posted 07 March 2013 - 08:57 PM

Where did you put that line?

Can you post a better screenshot? It's very hard to tell anything from that. We don't know what the object is supposed to look like, so it's hard to tell what's wrong.

How does it look from different angles?
What does the original look like in your modelling program?
Is it really transparent? Can you put something other than a blank background behind it, so it is easy to tell?

 

I put the line right after I set my new render target.

 

        public override void Draw(GameTime gameTime)
        {
            XNAGame.Instance.GraphicsDevice.SetRenderTarget(RT);
            XNAGame.Instance.GraphicsDevice.Clear(Color.Transparent);
            XNAGame.Instance.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    //part.Effect = e;
                    e.Parameters["World"].SetValue(transforms[mesh.ParentBone.Index] * Matrix.Identity);
                    e.Parameters["View"].SetValue(Matrix.Identity);
                    e.Parameters["LightDirection"].SetValue(Vector3.Normalize(Skydome.Instance.sunDir));
                    e.Parameters["CameraPosition"].SetValue(XNAGame.Instance.Camera.Position);
                    e.Parameters["Projection"].SetValue(Matrix.Identity);
                    e.Parameters["ColorMap"].SetValue(diff);
                    e.Parameters["NormalMap"].SetValue(norm);
                    e.Parameters["SpecularMap"].SetValue(spec);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                    //e.Parameters["Projection"].SetValue(XNAGame.Instance.Camera.ProjectionMatrix);
                }
                mesh.Draw();
            }
            RtTex = RT;
            XNAGame.Instance.GraphicsDevice.SetRenderTarget(null);
            
            //Stream str = File.OpenWrite("Dump.png") ;
            //RtTex.SaveAsPng(str, RtTex.Width, RtTex.Height);
            //str.Close();
        }
    }

 

 

Here is a photo of the gun in game, without using a different render target.

 

2l7ic9H.jpg

Is your camera positions such that it is inside the camera?  This would make you only see faces that are pointing towards the camera even though it is inside, meaning that there would be lots of faces culled out by back face culling.

 

I've tested it with other models and tried moving the model further away. Nothing seems to work.


PARTNERS