|
mikeschuld
|
 |
« on: 2006/10/22 20:34:44 » |
|
Talk about the Shader/Camera tutorial here [Quick Help]For those who are having problems running the shader, check your card Shader model, if it is not SM 3.0, then change the compile lines in the shader so it compiles to SM 2.0 technique TransformTexture { pass P0 { VertexShader = compile vs_2_0 Transform(); PixelShader = compile ps_2_0 Texture(); } }
|
|
|
|
« Last Edit: 2007/01/25 17:02:38 by Chr0n1x »
|
Logged
|
|
|
|
|
patricker
|
 |
« Reply #1 on: 2006/11/08 06:31:47 » |
|
I'm having an issue with the Tutorial, tried downloading your copy to see if I could fix my problem but when I build and ran the copy on your site I get the same error:
Error: Both a valid vertex shader and pixel shader (or valid effect) must be set on the device before draw operations may be performed.
The place it hits this error is: HMTexturedQuad.cs Line 56
myDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
Any Ideas?
--Peter
|
|
|
|
|
Logged
|
|
|
|
|
mikeschuld
|
 |
« Reply #2 on: 2006/11/08 16:41:58 » |
|
are you not changing it to use pixel shader 2? My default in the shader itself is to use 3. See if that helps
|
|
|
|
|
Logged
|
|
|
|
|
patricker
|
 |
« Reply #3 on: 2006/11/08 17:10:10 » |
|
Thanks, that fixed it.
I really do like your tutorials. I went through them all the way before the update and I'm going back through them again. I am very much looking forward to the next one.
--Peter
|
|
|
|
|
Logged
|
|
|
|
|
hoax
|
 |
« Reply #4 on: 2006/11/09 08:19:08 » |
|
I'm think that classical fps spectator mode for camera would be better choice. Try move your mouse by circle trajectory and say me after two seconds, where is ceil, and where is floor 
|
|
|
|
|
Logged
|
|
|
|
|
mikeschuld
|
 |
« Reply #5 on: 2006/11/09 23:18:39 » |
|
I have a solution for this problem that is being added into the next tutorial. This is simply because the mouse pointer only tracks to the edges of the screen (in fullscreen mode) so the movement of the camera has to stop. This is a Beta 2 XNA change and was not apparent in Beta 1. A workaround is simply resetting the mouse position to window center at each update.
|
|
|
|
|
Logged
|
|
|
|
|
zdave
|
 |
« Reply #6 on: 2006/11/10 03:27:14 » |
|
Another thing you can try is resetting the rotation quaternion on each update, and keeping track of the pitch and yaw angles instead. This eliminates the roll that apparently comes about from successive pitch and yaw rotations. Something like this worked for me:
yaw += mouseDx * 0.01f; pitch += mouseDy * 0.01f;
camera.Rotation = Quaternion.Identity; camera.Rotate(Vector3.UnitY, yaw); camera.Rotate(Vector3.UnitX, pitch); ...
~David
|
|
|
|
|
Logged
|
|
|
|
|
|
|
zdave
|
 |
« Reply #8 on: 2006/11/10 20:57:47 » |
|
OK I understand the problem, but how does it occur if only quaternions are used? I haven't seen it happen yet doing it this way...
What do you suggest is the best way to cancel the rolling effect?
|
|
|
|
|
Logged
|
|
|
|
|
mikeschuld
|
 |
« Reply #9 on: 2006/11/11 03:39:30 » |
|
Gimbal lock can't occur with just quaternions, so if you have seen it at all with just those, then something else must being going wrong somewhere. The best solution I have found for the camera stopping anywhere is just to set the mouse position to somewhere in the middle of the game window so that it always has room to move around not matter where it was last frame.
|
|
|
|
|
Logged
|
|
|
|
|
Marlun
|
 |
« Reply #10 on: 2006/11/16 07:27:35 » |
|
I've come as far as trying to run the application to see the textured quad in the center of the screen (just befor adding the camera) but I'm having a problem. I'm getting:
Error loading "Content\Shaders\TransformTexture". File not found.
when running the application. I copied the shader code from your example and added it to a file TransformTexture.fx. I added that file to my Content\Shaders folder. I've added it to "Copy always" and tested different Build Actions but none work.
What can be wrong?
Thanks in advance!
|
|
|
|
|
Logged
|
|
|
|
|
MicahN
|
 |
« Reply #11 on: 2006/11/16 08:55:11 » |
|
Make sure your "Asset Name" in the properties window of the shader is named the same as in the code. For example, TransformTexture and not TransformTexture.fx.
Micah
|
|
|
|
|
Logged
|
|
|
|
|
Marlun
|
 |
« Reply #12 on: 2006/11/16 11:37:27 » |
|
Hello, yes it is set to the same as what I'm having in my code. What should the Build Action be set to? Content?
Also, the "XNA Framework Content" is set to false, if I set it to true it won't compile.
|
|
|
|
|
Logged
|
|
|
|
|
Marlun
|
 |
« Reply #13 on: 2006/11/16 11:55:34 » |
|
I now also found that the program searches for "TransformTexture.xnb" and all I have in that folder is the TransformTexture.fx file, does the content pipeline need to compile it? When I set the XNA Framework Content to true I get an error: UnsuportedType, and if I click it the first word in the .fx file is selected: "float4x4".
|
|
|
|
« Last Edit: 2006/11/16 11:58:19 by Marlun »
|
Logged
|
|
|
|
|
mikeschuld
|
 |
« Reply #14 on: 2006/11/16 18:42:45 » |
|
Here are the settings for the shader file:
Build Action: Content Content Importer: Effect - XNA Framework Content Processor: Effect - XNA Framework Copy to Output Directory: Do Not Copy XNA Framework Content: True
|
|
|
|
|
Logged
|
|
|
|
|