Problems with shaders

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Problems with shaders

Post by Masterhawk »

Hey guys, I currently trying to implement shaders to my game, but there are a few obstacle to take.

Infos: Irrlicht 1.1, NewtonDynamics 1.53


#1: I followed the shader-tutorial step by step and everything works fine, except one thing. If my ball stands still and I move my cam around it, I don't see the shader effect, because it's always behind the sphere. Shouldn't it always be on the same position on the sphere(like in the shader tut)? When the ball is moving I can see the effect, but it seems that iit always tries to behind the sphere again, but it's too slow.

Image


#2: You see the big squares on the ball? Why does is it rendered so rough. in the shader tutorial it looks much smoother.


#3: What's about the nVIDIA shaders(http://developer.download.nvidia.com/sh ... brary.html)? Do I can use them? If yes, can anyone tell me how?
I tried to use the plastic shader, but my pogram says it cannot find ther vertexMain and pixelMain(or something like that :wink: ). These function do not appear in the nvidia shaders, so what should I do instead


Hope you understand my problems. If anything is not clear just ask me :wink:
Image
vi-wer
Posts: 93
Joined: Sun May 20, 2007 7:15 pm
Location: Germany
Contact:

Post by vi-wer »

1. The shader effect probably depends on the camera position. That's why it's always behind the sphere.
2. The normals of the ball are not 'smooth'. Does it look the same without the shader? I guess the vertices use face normals.
3. You can't use them as they are. Most of them have different techniques and passes that won't work with Irrlicht. You would have to extract the main vertex and pixel shader functions out of the shader file and create your own shader with a vertexMain and pixelMain function.
Masterhawk
Posts: 299
Joined: Mon Nov 27, 2006 6:52 pm
Location: GERMANY
Contact:

Post by Masterhawk »

1. Maybe, but it's not behind the sphere if the ball is moving....but it should, shouldn't it?

2.Well, if I would use dynamic lighting, the shadows would show exact the same behaviour...do you have an idea how to fix it??

3. Unfortunatly have currently no idea of shader development. So I thought about using the one developed by nvidia.
I'm not glad to hear that I'm not able to use them, but in this forum there are also a few skilled shader devs...;)
Image
vi-wer
Posts: 93
Joined: Sun May 20, 2007 7:15 pm
Location: Germany
Contact:

Post by vi-wer »

1. The effect seems to depend on the light position and another value. So everything is probably right.
2. Is the sphere a model you load from a file? If so you could try addSphereSceneNode() instead of the MeshSceneNode.
You can smooth the model with the software you used to create it (Just search for a smooth button :wink: ). Actually I don't know if Irrlicht has a similar function.
Robert Y.
Posts: 212
Joined: Sun Jan 28, 2007 11:23 pm

Post by Robert Y. »

To smooth your normals, you can use irr::scene::IMeshManipulator::recalculateNormals (*buffer, true)
Post Reply