Re: How to create a down light embedded in the ceiling

by enkonyito » Sun May 06, 2018 12:12 am

okh, in relation to your interrogation,
Last attempt of the day, a directional downlight with

Code: Select all

<light catalogId='okh#spot_dir_cut' name='Spot_focus_dir' creator='okh' model='1/downlight_directional.obj' icon='0' x='69.5' y='290.55923' width='20.0' depth='10.0' height='10.0' modelSize='14936' staircaseCutOutShape='m .52,0.5 a .23,.46 0,0,1 .46,0 a .23,.46 0,0,1 -.46,0 z' power='0.4'>
<lightSource x='0.25' y='0.5' z='0.7' color='00BB9854' diameter='0.125'/>
</light>
Point is, concept works, but the two variables are hard to handle. For me, anyway. LightSource diameter, LightSource placement in model. Which is the better generic model?
here are some details.

By default, SH3D uses the SphereLight type to render lights with the Sunflow rendering engine.
As you already know, just add these properties for an object to be considered a light by SH3D.

The LIGHT_SOURCE_DIAMETER property is optional.
If it is not present, a default value is used for the calculation of the radius of the sphere as for the lights created before SH3D-3.0.
When it is present, its value is taken into account and makes it possible to obtain soft shadows when the size of the light is enlarged.

Regarding the position of the light source in the Home.xml file, the values ​​represent a percentage of the width-depth-height of the object containing it.
In your example,

Code: Select all

<lightSource x='0.25' y='0.5' z='0.7' color='00BB9854' diameter='0.125'/>
would give in the PluginFurnitureCatalog.properties file

Code: Select all

lightSourceX#n=0.25*lightWidth
lightSourceY#n=0.5*lightDepth
lightSourceZ#n=0.7*lightHeight
lightSourceColor#n=#BB9854
lightSourceDiameter#n=0.125
My trick to properly position the light sources of a light is to match the lower left corner of the object with the origin (0, 0) of the Sweet Home 3D plan knowing that the Y axis is reversed.

Code: Select all

modelXplan = modelWidth / 2
modelYplan = -(modelDepth / 2)
Then we transfer the values ​​in the PluginFurnitureCatalog.properties file by adapting them like this:

Code: Select all

modelElevationProperties = modelElevationPlan
lightSourceXproperties = lightSourceXplan
lightSourceYproperties = -(lightSourceYplan)
lightSourceZproperties = (lightSourceDiameterPlan / 2) + lightSourceElevationPlan - modelElevationPlan
Hoping to have been pretty clear.