dancar812002 / papervision3d

Automatically exported from code.google.com/p/papervision3d
0 stars 0 forks source link

Shading artifacts with ShadedMaterial #190

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create cube with ShadedMaterial using any light shader ( i used
FlatShader) and some bitmap.
2. rotate it along y
3. for comparison create same cube with FlatShadeMaterial

What is the expected output? What do you see instead?
A smooth shading change on faces while cube rotates (as in cube with
FlatShadeMaterial). I get triangular shading artifacts.

What version of the product are you using? On what operating system?
rev859 on WindowsXP

Please provide any additional information below.

Original issue reported on code.google.com by jeziorsk...@gmail.com on 28 Apr 2009 at 1:37

Attachments:

GoogleCodeExporter commented 8 years ago
same here. I got a Collada object and I apply a MovieMaterial and a FlatShader 
to a
ShadedMaterial which gets mapped onto the object. I used precise = true, 
animated =
true in the constructor of MovieMaterial. This is the output:
http://imagebin.ca/view/Gm7JTM.html

When I use just a FlatShadeMaterial (so, only color, no bitmap behind), it looks
pretty decent (shading works perfectly), so it can't be about wrong normals or
overlapping triangles from the Collada export. 

Thing is, I want to animate the texture and I've already seen examples on the
internet where these shaders work on MovieMaterials ..

I am using revision 910 of papervision3d. I tried the trunk as well as the cs4 
branch
(since I am using cs4 to compile)

Original comment by tokyo.t...@gmail.com on 23 May 2009 at 12:25

GoogleCodeExporter commented 8 years ago
dunno what your code is like, but I've just had this same problem - either 
triangle
or blocky artifact effects, or the sides were black.

The solution was to make sure I use a different shader object for each 
ShadedMaterial
object I set up, instead of this:

var fs:FlatShader = new FlatShader(light, 0xFFFFFF, 0x222222);
smFront = new ShadedMaterial(mmFront, fs);
smBack = new ShadedMaterial(mmBack, fs);
smLeft = new ShadedMaterial(mmLeft, fs);
smRight = new ShadedMaterial(mmRight, fs);
smTop = new ShadedMaterial(mmTop, fs);
smBottom = new ShadedMaterial(mmBottom, fs);

I've had to do this:

smFront = new ShadedMaterial(mmFront, new FlatShader(light, 0xFFFFFF, 
0x222222));
smBack = new ShadedMaterial(mmBack, new FlatShader(light, 0xFFFFFF, 0x222222));
smLeft = new ShadedMaterial(mmLeft, new FlatShader(light, 0xFFFFFF, 0x222222));
smRight = new ShadedMaterial(mmRight, new FlatShader(light, 0xFFFFFF, 
0x222222));
smTop = new ShadedMaterial(mmTop, new FlatShader(light, 0xFFFFFF, 0x222222));
smBottom = new ShadedMaterial(mmBottom, new FlatShader(light, 0xFFFFFF, 
0x222222));

HTH, Dan

Original comment by danksea...@gmail.com on 29 Jun 2009 at 5:13

GoogleCodeExporter commented 8 years ago
Using one shader per material silves the issue. 

don't use  list.addMaterial( shadedMat, "all")  for your cube.

Original comment by Bab...@gmail.com on 28 Oct 2009 at 4:12

GoogleCodeExporter commented 8 years ago
Thanks guys! You saved my day!

Original comment by denis.ya...@gmail.com on 26 Aug 2010 at 10:17