Thanks, ggadwa. I'll mess around with the float ddx/ddy and change the uniforms. Could you maybe provide a list of uniform variables that you have built into the engine?
Anonymous Helper Wrote:Thanks, ggadwa. I'll mess around with the float ddx/ddy and change the uniforms. Could you maybe provide a list of uniform variables that you have built into the engine?
Wait for the next beta, I added a ton of them. The list will be in the docs (will be included.)
[>] Brian
I am trying to do Phong Shading, or at least the equivalent; I want objects to be all shiny, and it would be useful for rendering crystalline objects. Yet I have not been able to find a shader that is an equivalent, and the shaders that already come with Dim3 don't seem to work; no matter which type I use the result looks either unchanged, or changed to such a small degree I can't tell if the shader is doing anything or not....
Did I mention that I am no good at writing them myself (not yet, at least)?
Would be cool if progress could be made in the shader field, it's almost as comprehensive as the mesh transition, it would help basically everybody working on something here. For my game I would need some shiny metal shaders for the space ships.
Since the shader topic has come up again, this seems like a good time to ask:
(a) Can anybody tell me how to get the light position and the vertex position
in the same coordinate system? The obvious transformation matricies don't do the trick, and lighting is basically impossible without it. This is the closest I've come, but it only works in static camera mode:
Code:
//get vertex position in the same coord space as the dim3 lights
vertexPosition.xy=gl_Vertex.xy+dim3CameraPosition.xy;
vertexPosition.z=dim3CameraPosition.z-gl_Vertex.z;
(b) Are there any tricks for getting shaders to look decent when the user turns on ray-trace lighting?
Side Note: Anybody who is trying to learn GLSL needs to discover the Shader Builder app in Apple's dev tools, which does you the favor of checking your code for errors ahead of time.
I got about 60+ shaders that came with Shade 8. Lol. I'm not sure if I could let you use them though, might interfere with the user agreement or whatever.
cyst Wrote:(a) Can anybody tell me how to get the light position and the vertex position in the same coordinate system?
Those are in map coordinates, same as the vertexes. If you are in the fragment, you vertex has probably already been translated to GL coords, so you'll have to do the same translation, which most of the time is:
Code:
pos=gl_projectionMatrix*gl_ModelViewMatrix*myPosition;
cyst Wrote:(b) Are there any tricks for getting shaders to look decent when the user turns on ray-trace lighting?
There's probably not going to be a good way to deal with this. Ray tracing & raster type drawing (shaders) don't mix to well. You'd basically have to run your own lighting.
[>] Brian
Quote:Can anybody tell me how to get the light position and the vertex position in the same coordinate system?
Hey Cyst, I'm having the same problem at the moment - can't seem to get the light into eyespace to do the rest of the calculation. This gives the effect of the light being bound to the player somewhat, instead of it being static in the scene.
This is of course providing I have transposed the coords of the vertex into the right coord system - so far I have:
position = gl_Vertex * gl_ModelViewProjectionMatrix;
normal = gl_Normal * gl_NormalMatrix;
but getting the light there is still a problem... is this similar to what you're getting?
I'm going to be getting back to all of this soon after the mesh stuff is further along; sorry for the wait but I can only do so much at once
[>] Brian