Graphisoft®

Basic Library Version: 16

Lamp Elements

Index

  1. General Description
  2. Parameters
  3. ArchiCAD context
  4. Scripting

1. General Description

This document is a common description of lamp elements in ArchiCAD. The user can possibly create specific objects in GDL and the ones included in ArchiCAD Library are easy to alter.

For a correct example refer the Hanging Lamp Sample object of the Example Library.

2. Parameters

Only the differences from the Electrical Element subtype are listed here.

Name Type Description
C Boolean Light switch on/off
D Color Red color component in the [0-1] range
E Color Green color component in the [0-1] range
F Color Blue color component in the [0-1] range
G Intensity Intensity of the light in the [0-100] interval

These parameters can be modified using the following controls by the user:

Settings dialog section for light intesity and color

3. ArchiCAD context

2D view

You should provide an electrical symbol and a realistic drawing for 2D representation.

Don't use the projection of the 3D model whenever possible.

3D view

The key of a good lamp is a realistic light effect. To achive this you should know a couple things about about rendering in ArchiCAD.

This implies that you have to model some light effects by yourself. These are the following.

4. Scripts

In the following, we take the example of a simple hanging lamp.

Shade material manipulation

A user-friendly parameter can be the transparency of the shade - [0 - 1]. Let's see, how it can be handled.

Naturally you have to define a custom material in GDL. The sample code assumes that we have a material type parameter - shade_mat - and a real number - shadeTr.

rrrr = request ("Name_of_material", shade_mat, mName)
define material "mat1" based_on mName \
        parameters gs_mat_transparent = shadeTr

The next step is to light the inner surface of the lamp shade.

define material "mat2" based_on mName \
        parameters gs_mat_transparent = shadeTr,
        gs_mat_emission_r = D,
        gs_mat_emission_g = E,
        gs_mat_emission_b = F,
        gs_mat_emission_att = C * 2 * G / 100

Now, you can define the shade model using these materials.

Light the vicinity of the lamp

This previous manipulation of the materials won't result a correct lit circle on the ceiling, etc. This light should not cast shadows, the shade will cast shadows otherwise. To achive this use a tender point light as follows.

lwa_intensity = (2 ** (G * 0.03) - 1)    ! scale (0-100) intensity to (0-10)

...

light D * G/200, E * G/200, F * G/200,   ! RGB
        0,                               ! shadow on/off
        0,
        0, 0,
        0,
        0, dist2,                        ! light start - stop
        distFalloff ADDITIONAL_DATA lwa_light = "LWA_LIpoint",
        LWA_LIpoint_shadows = 0,
        LWA_LIpoint_falloff = "LWA_inversesquarelaw",
        LWA_LIpoint_intensity = lwa_intensity * 0.25,
        LWA_LIpoint_intensityunits = "LWA_empirical",
        LWA_LIpoint_color = colorRGB

Main light cone

Modelling the main light cone, the most important thing is to create smooth transition from the light to the darkness. This can be done differently in internal rendering and in LightWorks. The difference can be made by setting different light intensities for the different rendering engines.

For internal rendering you just specify a correnct inner and outer cone angle for a spot light. The inner angle should be implied by the shade geometry (atn (radius / shadeHeight)). The outer angle should be greater by 10 degrees at least.

For LightWorks rendering you should specify two light sources. One of them should cast hard shadows while the other soft shadows. Combining the intensity of the lights you can get a quite good picture. We used a 85 - 15 ratio in favour of soft shadows.

! spot light cone
light D * G/80, E * G/80, F * G/80,     ! RGB
        light_shadow,                   ! shadow on/off
        rLightCone,                     ! light cone radius
        halfAInnerCone, halfAOuterCone, ! cone angle inner - outer
        angleFalloff,                   ! angle falloff
        dist1, dist2,                   ! light start - stop
        distFalloff ADDITIONAL_DATA lwa_light = "LWA_LIgsspot",
        LWA_LIgsspot_radius = a2 - 0.01,
        LWA_LIgsspot_coneangle = halfAOuterCone * 2,
        LWA_LIgsspot_conedeltaangle = halfAOuterCone - halfAInnerCone,
        LWA_LIgsspot_anglefalloff = angleFalloff,
        LWA_LIgsspot_start = dist1,
        LWA_LIgsspot_stop = dist2,
        LWA_LIgsspot_distancefalloff = distFalloff,
        LWA_LIgsspot_intensity =  lwa_intensity * 0.85,
        LWA_LIgsspot_intensityunits = "LWA_empirical",
        LWA_LIgsspot_color = colorRGB,
        LWA_LIgsspot_shadowtype = "LWA_soft",
        LWA_LIgsspot_shadowquality = 8,
        LWA_LIgsspot_shadowsoftness = 2,
        LWA_LIgsspot_shadowresol = 1024,
        LWA_LIgsspot_shadowtolerance = 0,
        LWA_LIgsspot_colortemp = 0

light 0, 0, 0,                          ! RGB
        0,                              ! shadow on/off
        rLightCone,                     ! light cone radius
        halfAInnerCone, halfAOuterCone, ! cone angle inner - outer
        angleFalloff,                   ! angle falloff
        dist1, dist2,                   ! light start - stop
        distFalloff ADDITIONAL_DATA lwa_light = "LWA_LIgsspot",
        LWA_LIgsspot_radius = a2 - 0.01,
        LWA_LIgsspot_coneangle = halfAOuterCone * 2,
        LWA_LIgsspot_conedeltaangle = halfAOuterCone - halfAInnerCone,
        LWA_LIgsspot_anglefalloff = angleFalloff,
        LWA_LIgsspot_start = dist1,
        LWA_LIgsspot_stop = dist2,
        LWA_LIgsspot_distancefalloff = distFalloff,
        LWA_LIgsspot_intensity =  lwa_intensity * 0.15,
        LWA_LIgsspot_intensityunits = "LWA_empirical",
        LWA_LIgsspot_color = colorRGB,
        LWA_LIgsspot_shadows = 1,
        LWA_LIgsspot_shadowtype = "LWA_hard",
        LWA_LIgsspot_shadowtrans = 6,
        LWA_LIgsspot_shadowquality = 8,
        LWA_LIgsspot_shadowsoftness = 0,
        LWA_LIgsspot_shadowresol = 1024,
        LWA_LIgsspot_shadowtolerance = 0,
        LWA_LIgsspot_colortemp = 0