materials dont work?

im trying to assign ‘flatMaterial’ to the stickNode node. it doesnt do anything though…

from pandac.PandaModules import *
from direct.task import Task
from import Actor
from direct.interval.IntervalGlobal import *
import math
from pandac.PandaModules import Material
from pandac.PandaModules import VBase4
#VBase4 has to be imported in order to set colors in the methods

loadPrcFileData("", "framebuffer-multisample 1")
loadPrcFileData("", "multisamples 2")
loadPrcFileData("", "show-frame-rate-meter #t")

import direct.directbase.DirectStart

#Task to move the camera
def SpinCameraTask(task):
    move = 25*task.time
    angleradians = move * (math.pi / 180.0)*(math.sin(angleradians)),-20*(math.cos(angleradians)),3), 0, 0)
    return Task.cont

taskMgr.add(SpinCameraTask, "SpinCameraTask")

stickActor = Actor.Actor("models/box2anim.egg",{
stickActor.makeSubpart("left", ["l0","l1"])
stickActor.makeSubpart("right", ["r0","r1"])
stickActor.loop("rup", partName="right")
stickActor.loop("lup", partName="left")

stickNode = render.attachNewNode("stickNode")

flatMaterial = Material()

plight = PointLight('plight')
plight.setColor(VBase4(0.2, 0.2, 0.2, 1))
plight.setAttenuation(Point3(0, 0, 0.005))
plnp = render.attachNewNode(plight)
plnp.setPos(0, -2, 15)



What happens if you set an override?

stickNode.setMaterial(flatMaterial, 1)

it works then.

what is an overwrite/what does it do. why didnt it work without it?


also…the shininess doesnt seem to do anything ( i put it up high and still nothing), and my light is still fairly dull at an Attenuation of 0, 0, 0.005. very dull unfact. :S

can you tell me how i can modify those values to have a normal light and see the effects of the shininess? :confused:

Well, try enabling per-pixel lighting using setShaderAuto() - does that make the shininess show up?

The override is to override the material that might have been applied to a subnode.

i had no other materials applied though.

and no, that doesnt make it work either (shininess 0 is the same as 100 :frowning: )

Thanks for this tip. It solved a problem I was having with my lighting. I think it should be mentioned somewhere on the the manuals lighting page

are you able to get shinniness working? (if so, gimme source please?) :neutral_face:

Sorry no, Im not using shininess in my texture, my problem was lighting on a sphere I had looked real choppy and blocky until I used setShaderAuto() on it