Notifications
Clear all

[Closed] Exposure of photometric lights

 JHN

I can’t seem to find a way to set the type of ex/inclusion for the exlusion or inclusion of objects for photometric lights.

default max pointlights expose: “$.inclExclType” there seems to be no such property for a photometric light, although you can access the in/exclude object list… please someone tell me I’m wrong and I missed the obvious!

Thanks!
-Johan

9 Replies

nope – didn’t miss anything obvious.

The only thing you need to know is that when you -set- .includeList = #(<nodes>), the mode switches to include. If you -set- .excludeList = #(<nodes>), the mode switches to exclude. And if you need to know what mode it’s currently in, it’s whichever list returns an array (the other will return ‘undefined’). If you need to switch modes…


if ($.excludeList == undefined) then (
	$.excludeList = $.includeList
)
else (
	$.includeList = $.excludeList
)

 JHN

Yeah I got that part figured out, but I need to know in which mode it is, light/shadow etc…crap…whyyyyyy… what a day…

-Johan

uiaccessor?
runs

 JHN

Miljaar!!
*chases

oie… too early for UIaccessor stuff…

completely non-cleaned-up (mm, globals) and non-commented, but should do as the function name advertises…


  global BM_GETCHECK = 0x00F0
  global photometricIEmode = undefined
  dialogMonitorOPS.UnRegisterNotification id:#getPhotometricIEmode
  dialogMonitorOps.enabled = false
  
  -- get the Include.../Exclude... button from a selected Photometric light with the Modify panel active
  fn getPhotometricIEbutton = (
  	local maxHWND = windows.getMaxHWND()
  	local maxChildren = windows.getChildrenHWND maxHWND
  
  	local foundTab = false
  	local foundPanel = false
  	for child in maxChildren do (
  		if (child[4] == "ModifyTask") then (
  			foundTab = true
  		)
  		if (foundTab) then (
  			if (child[4] == "RollupPanelTitle") then (
  				if (child[5] == "General Parameters") then (
  					foundPanel = true
  				)
  			)
  		)
  
  		if (foundPanel) then (
  			if (child[5] == "Light Distribution (Type)") then ( exit )
  			else if (child[5] == "Include...") OR (child[5] == "Exclude...") then (
  				return child[1]
  			)
  		)
  	)
  	return undefined
  )
  
  
  fn getPhotometricIEmodeMon = (
  	local dlg_hwnd = DialogMonitorOPS.GetWindowHandle() -- check the dialog that popped up
  	local dlg_title = UIAccessor.GetWindowText dlg_hwnd
  	if (dlg_title == "Exclude/Include") then ( -- the obj export config dialog
  		local controls = windows.getChildrenHWND dlg_hwnd -- get all controls for this dialog
  		for c in controls do (
  			if (c[5] == "Illumination") then (
  				local c_hwnd = c[1]
  				c_state = windows.sendMessage c_hwnd BM_GETCHECK 0 0
  				if (c_state == 1) then (
  					photometricIEmode = #illumination
  					UIAccessor.pressButtonByName dlg_hwnd "OK"
  					return true
  				)
  			)
  			else if (c[5] == "Shadow Casting") then (
  				c_hwnd = c[1]
  				local c_state = windows.sendMessage c_hwnd BM_GETCHECK 0 0
  				if (c_state == 1) then (
  					photometricIEmode = #shadow
  					UIAccessor.pressButtonByName dlg_hwnd "OK"
  					return true
  				)
  			)
  		) -- for c in controls
  		photometricIEmode = #both
  		UIAccessor.pressButtonByName dlg_hwnd "OK"
  	) -- hwnd_title == "OBJ Export Options"
  	true
  )
  
  
  fn getPhotometricIEmode l = (
  	photometricIEmode = #error
  	local oldSel = getCurrentSelection()
  	local oldTask = getCommandPanelTaskMode()
  	select l
  	max modify mode
  	local IEbutton = getPhotometricIEbutton()
  	if (IEbutton == undefined) do ( return false )
  	dialogMonitorOPS.RegisterNotification getPhotometricIEmodeMon id:#getPhotometricIEmode
  	dialogMonitorOps.enabled = true -- enable the monitor
  	UIAccessor.pressButton IEbutton
  	setCommandPanelTaskMode oldTask
  	dialogMonitorOps.enabled = false -- disable the monitor
  	dialogMonitorOPS.UnRegisterNotification id:#getPhotometricIEmode
  	select oldSel
  	photometricIEmode
  )
  

usage:
<name>getPhotometricIEmode <photometriclight>
possible return values:
#error – something went wrong… probably not a photometric light?
#illumination – exactly what you’d expect it to mean
#shadow – yup
#both – indeed

edit: #test -> #getPhotometricIEmode

 JHN

You just couldn’t resist right

Thanks man, I will look into it, but we just had a “technical meeting” and decided that for our current project we are ditching all photometric lighting in favor of point lights, not because of this issue though, but my tool only has to handle pointlights for now…
Our environments are so large that we are taking the pointlight “light energy everywhere” instead of the cool realistic fallofs of photometric lights.

I will look at the code and try to implement it and see if works for the skydome approach we’re using.

Thanks!!!
-Johan

had to try

photometric lights are just glorified regular ol’ lights anyway. the temperature control is just a filter on top of a regular color, the photometric units are just multipliers on top of the regular multiplier, etc. The only ‘special’ thing is the whole photometric web which, if you were so inclined and point lights weren’t stupid*, you could render out to a lat/long bitmap and use as a projector.

  • point lights handle projectors as if the light is actually 6 lights, each illuminating a face of a cube sigh so you have to opacity-map it to geometry and have the light use raytraced shadows and argh.

Anyway – good luck

 JHN

But I’m correct if I say that photometric lights always have falloff, right, I don’t need that I have huge environments and objects moving through it should be constantly lit, like if all lights where suns. I’m pretty comfortable I think, with using photometric for closed environments and daylight for outdoor scenes, but I’m in outer space and some other dimensions too, that require a different approach, I want to be able to use low intensity ambient light with different colors from different angles and some suns casting shadow.
Am I right thinking photometric lights cannot give me that and I need a more old school approach?

I’m interested in the lat/long bitmap, could you maybe explain a bit more what you mean, I’m not really following

Thanks,
-Johan

they have an inverse square decay set up by default, yes – nothing you can’t do with regular ol’ lights

as for the lat/long bit – that was just me mumbling
An IES web file, for most common lights, defines a series of angles at which lighting is sampled for the light in question, and the intensity of the light at that angle. A lat/long image – like many HDR images – could contain fairly much the same information; won’t do you any good, though, as point/omni projector lights are funky =)