Personal tools
You are here: Home / cmgui / Wiki / CMGUI lights and materials
Log in

Forgot your password?

CMGUI lights and materials

This tutorial draws content from some examples, particularly example a2 and example a/per_pixel_lighting

This tutorial is intended to get you to understand the different ways lighting and materials can be made to make you scenes look better in cmgui.

  1. Default lights. In CMGUI the default lighting is a directional light that is attached to your view, you can consider it a sort of headlamp. This default light is slightly above you and pointing slightly down. Here I have loaded up a slightly deformed cube and drawn surfaces on it.

    <img src="default_light.png" />

    This is the script that generates this image,

    gfx read elements bicubic_linear_cube.exelem;
    gfx create win 1;
    gfx modify window 1 view parallel eye_point -1.30343 -2.5881 1.50531 interest_point 0.505811 0.497157 0.48454 up_vector 0.144703 0.233287 0.961581 view_angle 40 near_clipping_plane 0.0371942 far_clipping_plane 13.2919 relative_viewport ndc_placement -1 1 2 2 viewport_coordinates 0 0 1 1;
    gfx modify window 1 set perturb_lines;
    gfx modify g_element single surfaces select_on material copper selected_material default_selected render_shaded;

    You can list the parameters of this light like this:

    gfx list light default;

    Which in this case returns:

    light : default : infinite
      colour  red = 1, green = 1, blue = 1
      direction  x = 0, y = -0.5, z = -1