[Closed] Select vertices from a shadow
Hi scripters
I don’t have much experience with 3ds max scripting, I started making my own scripts 3 days ago and now I have a problem.
I have 2 planes (with dense meshes). The first one is parallel to the ground (XY plane), and the second one have a random rotation. I have a light above them. I would like to “project” the second plane to the first, ground plane on the vector (light.pos – second_plane.pos) and select all the vertices in the area of this projection on the ground plane, it will be something like “select verts which are in the shadow” (I mean of course the parallel projection, not perspective, the “shadow” is only approximation).
Is there a simple way to do that? I wouldn’t like to use the brute force method like intersectray from every vert etc., my script is already slow
You needn’t necessarily use script, you could render a ambient occlusion pass baked-to-texture and then use this as a map in a Volume Select to select the vertices.
But this thing is going to be just a part of my script and I guess that rendering AO pass will be really time consuming
Probably quicker than doing it on a per vertex basis with high-res models. It’s all still totally scriptable, even if it’s an animation…
You could take your plane and then simply extrude a face along the vector so that it penetrates through you ground plane then use this extruded object as a vol select mesh
you could do something like this:
- loop through all of the ground plane’s vertexes.
1.1 create a ray positioned at the vertex, directed at the light.
1.2 use intersectRay on the other plane, with this ray.
1.3 if the intersectRay returns a hit (and the hit is closer to the vertex then the light) append this vertex to the selection.
TzMtN, not bad idea, but my ground have a VERY dense mesh, so looping through all verts will be extremely slow, I’ll do the thing with Vol. select like MattRennie said, thanks for help