3D Rendering Fundamentals

I am about to simulate a 3D renderer. My “monitor” consists of a series of rectangles. the camera is just a point in front of the monitor and the object that will later be illuminated by a virtual light is “behind” the monitor. From the camera, rays are sent through the monitor “pixels” and checked whether they hit an object. depending on this, the angle or the color of the monitor “pixel” is changed later.

I have noticed that the ray detection is not accurate as you can see at the right top corner of my monitor. this seems to be a bug that no one has noticed yet.

PS: this is not a matter of the target object. You can displace it from the rays!?

It does work when you do

mesh_object.computeWorldMatrix();

before the render();

https://playground.babylonjs.com/#1Z858J#1

3 Likes

I am back again with an unsolvable problem… for me.

I would like render the scene after some seconds again, but as you can see:

It didn’t work for me either in your original PG when I put render(); in a timeout, but seems like it works if you remove

forward = vecToLocal(forward, mesh_from); from castRay

https://playground.babylonjs.com/#1Z858J#3

2 Likes

super!

for the moment it’s fast enough to put the rendering into the beforeRendering. You can drag the object and the monitor updates. :slight_smile:

my next step is

  • calculating the distance from the picked mesh to the light-point. This will be the color value of the pixel calculated down to values between 0 and 1.

if this works there is no reason not to use much more light sources and objects… and higher resolution… :slight_smile: The game performance will run to 0 fps but with beautful scenes full of light! :smiley:

Cool effect, it’s like something I saw a long time ago, apparently it was from from Daniel Rozin, and he makes stuff like this:

https://www.youtube.com/results?search_query=Daniel+Rozin

Good luck with your project!

1 Like

3D Monitor Simulation

  • moving camera
  • multi objects
  • distance as z position

The objects can be in front of the monitor, too:

2 Likes

lunar eclipse

  • camera: gray sphere
  • moon: green sphere
  • sun: yellow sphere

3D Monitor Upgraded