A
A
Alexander Belyakov2017-01-08 15:55:12
JavaScript
Alexander Belyakov, 2017-01-08 15:55:12

What library or technology is better to use for the task of accounting for shadows?

Hello everybody!
I'm trying to solve the following problem in the field of 3D modeling.
There is some plane given in space, a light source moving according to a given equation, and some given object between the light source and the plane, which casts a shadow on the plane. The shadow, as the light source moves, changes its shape and position on the plane.
The task is to divide the plane under study with a grid with a step h and at a certain point in time to analyze each cell for the presence of a shadow in it.
I'm trying to solve this issue using the three.js library. It was possible to form all the conditions of the task, it is not possible to access the mathematics of the plane and the shadow on it in order to analyze the cells. There is a minus - the shadow is slowly formed and the solution of the problem through this library is expensive in terms of computing power. Although if someone tells me how to do it through three.js, I will be glad.
To solve the problem, I looked at lower-level WebGL and OpenGL libraries. There, in principle, it is possible to solve the problem through shaders, but the entry threshold is quite high, if there is absolutely nothing left, then I will study them.
What technologies and libraries can you suggest for solving this problem?
My preferred field of work is JavaScript. Ready to consider options with C++ and C#.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Alexandrov, 2017-01-09
@parce56

Look towards THREE.Raycaster(). Get a light source. From it you throw "rays" along the faces of the model, on the plane you project points along the castes, along the points of the model, this will be a shadow. The plane itself with the h grid will be a little easier to divide into separate objects in the scene (each cell is a separate object) and then it will be very easy to catch which cell has a shadow and which does not.

A
Alexander Skusnov, 2017-01-08
@AlexSku

Articles about shadow mapping and algorithms from NVIDIA

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question