平面的阴影

编程入门 行业动态 更新时间:2024-10-27 11:16:56
本文介绍了平面的阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

这可能是一个初学者的问题,但为什么飞机看起来是平的?为什么看不到飞机的结构,只有边缘的尖刺?

It is probably a beginner question, but why does the plane appear to be flat? Why is the structure of the plane not visible, only the spikes on the edges?

http://codepen.io/asz/pen/GgXpXW

var geometry = new THREE.PlaneBufferGeometry( 100, 100, 50, 50 );

var vertices = geometry.attributes.position.array;
for ( var i = -1; i < vertices.length; i += 3) {
  vertices[i] = Math.random() * 10;
}

geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2.8 ) );

var material = new THREE.MeshPhongMaterial( { ambient: 0x00ff00, color: 0x00ff00, specular: 0x00ff00, shininess: 30, shading: THREE.FlatShading } );
var ground = new THREE.Mesh( geometry, material );
scene.add( ground );

推荐答案

处理法线.
添加 geometryputeVertexNormals();

例如

var vertices = geometry.attributes.position.array;
for ( var i = -1; i < vertices.length; i += 3) {
  vertices[i] = Math.random() * 10;
}
geometryputeVertexNormals();

这篇关于平面的阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 15:02:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1395746.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阴影   平面

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!