|
364 | 364 | "void getGlossiness() {",
|
365 | 365 | " dGlossiness = 1.0;",
|
366 | 366 | "",
|
367 |
| - " #ifdef MAPFLOAT", |
368 |
| - " dGlossiness *= material_shininess;", |
369 |
| - " #endif", |
| 367 | + "#ifdef MAPFLOAT", |
| 368 | + " dGlossiness *= material_shininess;", |
| 369 | + "#endif", |
370 | 370 | "",
|
371 |
| - " #ifdef MAPTEXTURE", |
372 |
| - " dGlossiness *= 1.0 - texture2D(texture_glossMap, $UV).$CH;", |
373 |
| - " #endif", |
| 371 | + "#ifdef MAPTEXTURE", |
| 372 | + " dGlossiness *= texture2D(texture_glossMap, $UV).$CH;", |
| 373 | + "#endif", |
374 | 374 | "",
|
375 |
| - " #ifdef MAPVERTEX", |
376 |
| - " dGlossiness *= 1.0 - saturate(vVertexColor.$VC);", |
377 |
| - " #endif", |
| 375 | + "#ifdef MAPVERTEX", |
| 376 | + " dGlossiness *= saturate(vVertexColor.$VC);", |
| 377 | + "#endif", |
| 378 | + "", |
| 379 | + " dGlossiness = 1.0 - dGlossiness;", |
378 | 380 | "",
|
379 | 381 | " dGlossiness += 0.0000001;",
|
380 | 382 | "}"
|
|
384 | 386 | var material = new pc.StandardMaterial();
|
385 | 387 |
|
386 | 388 | // glTF dooesn't define how to occlude specular
|
387 |
| - material.occludeSpecular = false; |
| 389 | + material.occludeSpecular = true; |
388 | 390 | material.diffuseTint = true;
|
389 | 391 | material.diffuseVertexColor = true;
|
390 | 392 | material.chunks.glossPS = glossChunk;
|
|
425 | 427 | material.metalness = 1;
|
426 | 428 | }
|
427 | 429 | if (pbrData.hasOwnProperty('roughnessFactor')) {
|
428 |
| - material.shininess = 100 * (1 - pbrData.roughnessFactor); |
| 430 | + material.shininess = 100 * pbrData.roughnessFactor; |
429 | 431 | } else {
|
430 |
| - material.shininess = 0; |
| 432 | + material.shininess = 100; |
431 | 433 | }
|
432 | 434 | if (pbrData.hasOwnProperty('metallicRoughnessTexture')) {
|
433 | 435 | var metallicRoughnessTexture = pbrData.metallicRoughnessTexture;
|
434 | 436 | material.metalnessMap = resources.textures[metallicRoughnessTexture.index];
|
435 | 437 | material.metalnessMapChannel = 'b';
|
436 | 438 | material.glossMap = resources.textures[metallicRoughnessTexture.index];
|
437 | 439 | material.glossMapChannel = 'g';
|
438 |
| - if (!pbrData.hasOwnProperty('roughnessFactor')) { |
439 |
| - material.shininess = 100; |
440 |
| - } |
441 | 440 | if (metallicRoughnessTexture.hasOwnProperty('texCoord')) {
|
442 | 441 | material.glossMapUv = metallicRoughnessTexture.texCoord;
|
443 | 442 | material.metalnessMapUv = metallicRoughnessTexture.texCoord;
|
|
457 | 456 | if (data.hasOwnProperty('occlusionTexture')) {
|
458 | 457 | var occlusionTexture = data.occlusionTexture;
|
459 | 458 | material.aoMap = resources.textures[occlusionTexture.index];
|
| 459 | + material.aoMapChannel = 'r'; |
460 | 460 | if (occlusionTexture.hasOwnProperty('texCoord')) {
|
461 | 461 | material.aoMapUv = occlusionTexture.texCoord;
|
462 | 462 | }
|
|
0 commit comments