Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: NevilleKemp

26. May 2012, 06:43:17 pm
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Light with no Material
Pages: [1]
Print
Author Topic: Light with no Material  (Read 182 times)
PeterRadkov
Just dropped in

Offline Offline

Posts: 8


View Profile
« on: 01. December 2011, 02:02:04 pm »

Hi All!

  I'm trying to get a mesh to get illuminated correctly. I use a directional light, and a per-vertex color and normal, without a material set in the Appearance.

  No matter how I set the intensity/color of the light, the rendering is the same. When I set a material on the mesh however, the lighting parameters are respected OK, but I cant get the per-vertex color to show when I set a material.
  I'm trying to achieve a nicely shaded high poly mesh representing elevation data.
  What am I missing? Sad

Thanks.
Logged
PeterRadkov
Just dropped in

Offline Offline

Posts: 8


View Profile
« Reply #1 on: 01. December 2011, 02:26:13 pm »

Hi! ,

  Here are 2 snapshots illustrating my conundrum.
  Additionally to those - the shading appears flat when the material is set? Is this normal?

Thanks.
Logged
PeterRadkov
Just dropped in

Offline Offline

Posts: 8


View Profile
« Reply #2 on: 01. December 2011, 03:46:56 pm »

Re: The flatness of the shading was my mistake, I was calling generateFaceNormals on the geometry. But still the material/color/light problem persists...
Logged
PeterRadkov
Just dropped in

Offline Offline

Posts: 8


View Profile
« Reply #3 on: 01. December 2011, 03:52:40 pm »

Just to compare - Java3D renders the same mesh like this (attached).

In Xith3D - I came to these observations:

When material.setLightingEnabled(true) - properly illuminated, but single (material) color.
When material.setLightingEnabled(false) - vertex colors and normals are OK, but the light gets ignored.

Is there a work around for this or am I just not using the API correctly?
Any help will be highly appreciated.

Thnaks.
« Last Edit: 01. December 2011, 05:16:45 pm by PeterRadkov » Logged
PeterRadkov
Just dropped in

Offline Offline

Posts: 8


View Profile
« Reply #4 on: 02. December 2011, 07:49:48 am »

It turns out that I've missed to set the colorTarget on the material. Setting the color target to diffuse fixed the problem.

Thanks.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #5 on: 02. December 2011, 12:11:30 pm »

Good to know. Thanks for the finish.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic