Hi all,
this is my first post here.
actually i m getting problem in explaining exactly what is the problem...so let me explain what i want.
i want to control object’s visibility based on camera resolution gate..if they are out of camera...their visibility should be 0 and if they are in the capture of camera resolition gate(let us assume z-axis as infinite here)...visbility should be 1.
i tried to find some script or function which i can use to get the rquired in formation, but could not.
so i created a polyCube and parented it to the camera..then matched it’s size with the area of objects visible through camera, after that i extracted it’s bounding box information and got my objects visbility off if they are out of this…
for further accuracy.. i also added polyplanes in all sides.
but the thing is that they are never 100% accurate…and too manual
so is there any other technique to do this…
my script is also working, just it is a home made remedy to implement in specific scene.....that’s why i wanted a gud idea to make it an independent script.
if u already know about any script that does it...then please let me know
thanks in advance,
amitesh
Well, theres really no benefit of doing this as the computer already does this in its pipes. But yes i guess you could save time from dg evelauation.
Wyhat you would do is calculate the image projection matrix against the bb and see if it is with the culled area...
But this is the sort of thing yyoud do in the api not mel.
no actually i m implementing this technique for my particle instancer........
i want diff level of detail and if they are out of camera their visibility should just be off...
in playback i accpet it's not so fast but for rendering it's quite gud..
after implementing my script i m reducing render time a lot, almost half or more(diff LoD objects for distant particles)....
but the problem is that i have to adjust poly plane(to check the boundry of camera) accoring to camera view in each scene so it's not so accurate..
i hope u r getting me.
amitesh
Again nothing you would sue mel for as the projection values are so tricky to deal with in mel. And mel has so low performance on stuff like this. So what you owudl sue is api and make a node.
But yes you can do this with existing nodes point matrix multiplyy the point against the cameras projection matrix (this is a wee bit tricky its balantly simple in api but about a weeks worth of design in mel) against the bb size of your particle then measure the point form in x y directions acording to film projection widths thats it.
Also in the api you could do this on a per pixel view basis if you wished, for a even more accurate cull.
PS: renderers dont get impacted by much either, mr and prman might get slight impact on first frame but not much after that.
Thanks joojaa,
now i understand what u r saying...but trully speaking that is out of my capacity...i don't know api []
anyway thanks for ur so quick and helpful replies. []
can u sujjest me some tutorial,books,sites to start learning mel and api indepth. i have basic knowledge of C++ and mathematics.
regards,
amitesh
this should be pretty easy, you have two choices
project a particle to screenSpace and reject if it's outside image plane. Check screenSpace.mel by Rob Bredow http://www.185vfx.com/
this one is simpler i guess: measure an angle between eyeToParticle vector and viewing vector. Think three points in space: A.particle worldPos B. cameraWorldPos C.(0,0,1) point in camera coordSys (like locator parented unedr camera). Then measure angle between BA and BC, and if it's larger than cam's viewing angle --> reject particle.
Both methods have a problem with bounding boxes though, so indeed it may be better to leave it for renderer to cull. Perhaps you can choose some treshold numbers for viewingAngle or imagePlaneSpace position that will work in a particular case.