1

If I have an object in three.js which has a texture applied to it (a colourful texture), for example a car - how can I add a partial reflection to the surface, so that the final material is say, the combination of a shiny red metal and the reflection of the scene?

I am familiar with creating reflections using an additional camera and cube mapping, but I am not sure how to combine this with an objects existing material.

An example of the reflection method I am using can be found here:

https://github.com/mrdoob/three.js/commit/4d1dd95d62ff48b1842bf4e3fe0c393f5bd6f4d6#commitcomment-1832509

If it is possible to combine the materials, is it possible to control the opacity of each part (the original material vs the reflection) to control how 'reflective' a surface is?

Many thanks

4

1 に答える 1

2

はい。ただし、表面の反射率を制御するのは、ではreflectivityありません。opacity

この例を参照してください:http://mrdoob.github.com/three.js/examples/webgl_materials_cubemap.html

編集:この例では、マテリアルに適用されたテクスチャは表示されていませんが、上記の例では、次のように追加できます。

var texture = THREE.ImageUtils.loadTexture( 'texture.jpg' );

var cubeMaterial1 = new THREE.MeshLambertMaterial( {
    color: 0xffffff,
    ambient: 0xffffff,
    map: texture,
    envMap: reflectionCube
} );

(補足としてcubeMaterial1、この例では、変数名の通常とは異なる選択にもかかわらず、メッシュに適用されたマテリアルがあります。)

于 2012-09-11T15:00:11.160 に答える