Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
7 years ago

DIffuse/Paralel Lighting Example for the C++ API

Hello! I'm trying to adapt the RoomTiny example to use it for visualization of 3D Models in the Rift. I'm using the DX11 sample, on the latest OVR SDK. I've managed to load several triangle-based files (STL, VTP). The problem is that they don't have any lighting based shading, they look doll. So I googled around and found a decently explicative DirectX11 set of examples, but as I'm un(experienced, I can't figure out how to adapt this(https://www.braynzarsoft.net/viewtutorial/q16390-simple-lighting) tutorial for the RoomTiny example. 
Does anyone have a working example of Diffuse Lighting or an adaptation of RoomTiny that includes it(even better)/tutorial on how to implement lighting to the C++ API? I'd greatly appreciate it.
Edit: This example is also very detailed: http://www.rastertek.com/dx11tut06.html

2 Replies

  • Anonymous's avatar
    Anonymous
    Thanks a lot! After researching a lot, I found I could attempt that same sequence. I was unsure if it would work because I've seen most examples applying the lighting calculations in the pixel shader, so I've been trying to modify the example to use external shaders (with no luck).

    However, I'll get on with those steps. Will post my results and my code when it's working for anyone else who might need it in the future.

    I've one more question, if it's not a problem: Why is the RenderInstanced function never executed (hence, the instanced stereo vertex shader is never applied). I added an OutupDebug instruction inside the Scene::RenderInstanced call and it never gets executed. What is the purpose of the instanced stereo shader/render function?
  • Anonymous's avatar
    Anonymous
    I ended up doing it on the OpenGL example because it was much simpler than the DX11 one. Also, I had to modify the shaders to pass along the World Matrix, as I need to multiply the Normals by that in order to have them referenced. Otherwise the lightng changed as I moved around the World.