2
$\begingroup$

I was wondering if there is a way to use blender to project a grid unto a model and only keep the points that the projection collides with, basically I want to simulate a Time of flight sensor that emits a laser grid and receives the reflection of that laser which indicates the presense of an object and its distance, ideally slanted objects would reveive the laser but reflect it to a different direction and thus would not show up on the output of the sensor. Would this be doable using a python script? Anything that could set me on the right track would be appreciated.

$\endgroup$
1
$\begingroup$

Not a scripted solution, but you can achieve a similar effect using a particle system.

collision particles

Create an emitter plane and a particle system. This will have all the particles emitted at frame start = end = 1.000 and a lifetime long enough for the collision.

Set the emission to grid and assign a velocity in the correct direction in the Emitter object box. Leave all the other options to their defaults (Newtonian physics with all the forces = 0) and in Field weights remove the effect of Gravity by setting gravity to 0.

Last, you would like to render the particles as lines. Select Line under Render, set Tail to zero and Head to some value between 0 and 1. Use a high trail count and set Length as long as your particles lifetime. Also, tick Length in frames.

Now, make sure that all the objects that you want to detect have a Collision property (with default values).

(Now you can also add another plane - as a "sensor" - behind the emitter and make it collide with the particles that are coming back, killing them. Then you can render the dead particles as dots on the sensor)

$\endgroup$
  • $\begingroup$ thank you very much, this was auite helpful and clear, I managed to put together an emitter than is quite similar to what I had in mind, I was not successful in having the second portion of you recommendation work, I am not quite sure how to render the particles that collide with the second plan (sensor receiver). One more problem I ran into was when I try to apply this during an animation the particle reflection behave oddly, like they keep orinating from a point where the target no longer exists isnce it has moved. recordit.co/CGb8sbpEdG $\endgroup$ – Alla Jul 6 '17 at 12:38
  • $\begingroup$ Actually, I thought there was an easier way to render "dead" particles. I was wrong: sorry! I can think of two ways to do that: one is using Dynamic paint: set the emitter to Dynamic Paint > Brush with your Particle System as a source, then set the "receiver" as a Dynamic Paint > Canvas. You'll have to play around with the settings for a good effect. Or you can make the sensor a collision object, with full stickiness, damping and friction, make the particles render as "object" and giving this object a material that is always transparent unless you are extremely close to the sensor. $\endgroup$ – Nicola Sap Jul 6 '17 at 12:59
  • $\begingroup$ blend-exchange.giantcowfilms.com/b/3489 This blend file shows an example of the Dynamic Paint method: open it and hit Alt+A to see the detector in action (then you'll have to link the Dynamic Paint information to your material in order to render it, which I haven't done) $\endgroup$ – Nicola Sap Jul 6 '17 at 13:17
  • $\begingroup$ Thanks again Nicola, I followed your instructions and set the emitter to a brush and the receiver to a canvas but I am a bit confused on how to display my canvas output, it must be soemthing ridiculously straightforward so do excuse my ignorance. $\endgroup$ – Alla Jul 6 '17 at 14:51
  • $\begingroup$ For that you'll need to create a material that uses the dynamic paint information. Here you can find more: blender.stackexchange.com/questions/66449/… (dynamic paint is not a beginner topic, but even if it was there would be nothing to apologize for!!!) $\endgroup$ – Nicola Sap Jul 6 '17 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.