Notifications
Clear all

[Closed] blinders

is there anyone who knows a script which would work like the blinders from blur studio?

I want to be able to make a box which set’s the visibilty of all objects inside of it to 0.

Would it be hard to script something like this? or is there a script like this?

6 Replies

I’m making it for you now. It will be ready in under an hour.

-Dave

Ok. Here’s the script. Copy the code and paste in a new maxscript window and then click file->evaulate all.

It’s pretty simple. Since you did’nt specify any other features, I only made it do what you asked. You can use any object to get the bounding volume, not just a box, but it uses the selected object’s bounding box dimensions to work.

Also, objects that are not completly within the box will not be made invisible.

It is not setup to be animatable, but if you want that, I can make it work.

There is also a script availalbe at www.scriptspot.com called “Blinders 1.02” that operates in a much more usefull way if you are trying to hide alot of geometry from the camera. It works on the polygon level, by temporaraly deleting geometry that the camera cannot see. It works great. So if my simple script does not do what you want, then check that one out.


-->Checks to see if dialog already exists, and if so, deletes it before allow a new on to be created
---------------------------------------------------------------------------------------------------------
try destroyDialog blindBox catch()
---------------------------------------------------------------------------------------------------------

-->FUNCTION: DMB_blindObjects
---------------------------------------------------------------------------------------------------------
fn DMB_blindObjects =
	(
	global allObjects = for i in geometry where not i.ishidden collect i
	global boxMax = blindBox.max
	global boxMin = blindBox.min
	global blindedObjects = #()
	global blindedObjectsVis = #()	
	
	for i in 1 to blindedObjects.count do
		(
		append blindedObjectsVis blindedObjects[i].visibility
		) 

	
	if allObjects != undefined do 
		(
		for i in allObjects do
			(
			if i.min.x > boxMin.x and i.max.x < boxMax.x and i.min.y > boxMin.y and i.max.y < boxMax.y and i.min.z > boxMin.z and i.max.z < boxMax.z do
				(
				i.visibility = false
				append blindedObjects i
				)
			)
		)
	
	)
---------------------------------------------------------------------------------------------------------


-->ROLLOUT: blindBox
---------------------------------------------------------------------------------------------------------
rollout blindBox "Box Blinder" width:160 height:88
(
	-->Control Definitions
	---------------------------------------------------------------------------------------------------------
	pickbutton DMB_Pbtn1 "Pick Volume Object" pos:[8,24] width:144 height:24
	label DMB_lbl1 "Blinding Object:" pos:[40,8] width:80 height:16
	button DMB_btn1 "Make Objects Invisible" pos:[8,48] width:144 height:32 enabled:false
	---------------------------------------------------------------------------------------------------------
	
	--Button Handlers:
	---------------------------------------------------------------------------------------------------------
	
		---------------------------------------------------------------------------------------------------------
		on DMB_Pbtn1 picked obj do
			(
			blindBox = obj
			DMB_Pbtn1.caption = blindBox.name
			DMB_btn1.enabled = true
			)
		---------------------------------------------------------------------------------------------------------
	
		---------------------------------------------------------------------------------------------------------
		on DMB_btn1 pressed do
			(
			DMB_blindObjects()
			DMB_btn1.enabled = false
			DMB_Pbtn1.caption = "Pick Volume Object"
			)
		---------------------------------------------------------------------------------------------------------	
	
	---------------------------------------------------------------------------------------------------------	
)

-->CREATE DIALOG:
---------------------------------------------------------------------------------------------------------
createDialog blindBox
---------------------------------------------------------------------------------------------------------

Enjoy!

-Dave

sorry for answering so late, i don’t have a connection at home …
thank you so much for the scirpt, it works quite good.

But since I need it for an animation it’s not useful for me at the moment.
I tried the blinder script once more from the r7 pack but it still is not working correctly, if i want to process the frames it always says i have deleted my blinder object…

another problem with your script would be… he sets the visibility to 0 but it’s still processed while rendering. I want to to be completely hidden. Is this possible?

So what i really need would be a script which would let me define a box as the blinder. Everything inside the box is visible, the rest is completely hidden. And the box should be animatible since i want to link it to my camera target.

Im making a 2d animation in max, and there are around 200.000 non instanced objects and it takes one hell of a time to process them before even rendering. so this script would save me weeks of rendering – or work.

Heya Lehmi,

Sorry that I cant offer help with the script but one thing to be aware of is that if objects are popping on and off outside of your camera then you’re going to end up with a lot of problems with shadows and reflections – an object that is outside the camera may cast a shadow that falls inside your rendered image or an object outside of camera may be visible in the reflection of an object in your rendered frame.

what I’ve tried doing here though is to make a cone that has the same dimensions as my camera fov and link it to the camera. then I selected all of the objects in my scene and gave them a volume select modifier. I set the vol select type to crossing and use a mesh object as my selection source. Lastly I set the selection to “invert” so everything outside my volume is selected instead of inside. I then added a deletemesh operator above the volume select so whats happening is everything outside my volume select is deleted. Lastly to make it work the way we want, I picked the cone tied onto the camera as the mesh object to use as my volume select source.

Unfortunately though this will cause the same errors as above and may even be slower to render than the option of leaving everything turned on – Depending on what you’re doing, you might be better looking at a renderer that can deal with large object sets more easily – are you using global illumination or motion blur? even the free version of vray may be faster.

Hey, just wanted to confirm that the blinders script does not work in r7. Something changed between 5 and 7’s maxscript functions that stopped it from working. I wrote the original blinders, but left blur 4 years ago, am not allowed to modify the script, and they have chosen not to update any of those scripts.

I also wanted to mention that joconnell is right, the reason the script ended up never getting used at blur is because stuff like shadows popping on and off. So something to consider. Sorry I can’t be of more help.

  • Neil

thanks for all the answers.

I never tried the delete mesh modifier, seems like an interesting solution for this stuff (atleast if it’s faster than processing all parts)

I have no problems with shadows or reflections whatsoever since it really is just a simple 2d animation without any shadows or ray traced materials, and actually there is no light at all (beside the standard light) though i’m using a lot of particle fx

i will try this method to see if it’s faster

I have scanline and mentalray at hand, and while mental ray needs more than 2 minutes to process a frame and around 3 seconds to render it, scanline needs around 15 seconds to process and around 5 seconds to render

sorry to hear that the blinder script has no chance of being updated but i think i’ll find a way to minimize rendertimes with a different approach