Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using light ramps


The lighting system of Panda3D allows you to pull off some additional tricks to create some dramatic effects with scene lights. In this recipe, you will learn how to use light ramps to modify the lights affect on the models and actors in your game scenes.

Getting ready

In this recipe we will extend the code created in Adding lights and shadows found in this chapter. Please review this recipe before proceeding if you haven't done so yet.

How to do it...

Light ramps can be used like this:

  1. Open Application.py and add and modify the existing code as highlighted:

    from direct.showbase.ShowBase import ShowBase
    from direct.actor.Actor import Actor
    from panda3d.core import *
    from direct.interval.IntervalGlobal import *
    
    class Application(ShowBase):
        def __init__(self):
            ShowBase.__init__(self)
    
            self.panda = Actor("panda", {"walk": "panda-walk"})
            self.panda.reparentTo(render)
            self.panda.loop("walk")
    
            cm = CardMaker("plane")
            cm.setFrame...