如何使用three.js绘制自定义3d曲面? [英] How do I draw a custom 3d surface using three.js?

查看:211
本文介绍了如何使用three.js绘制自定义3d曲面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要使用什么功能/数学来绘制3d曲面?例如,如何生成z = sin(x + y)?如何计算和绘制点?我找不到任何例子.

What functions/math do I use to draw a 3d surface? For example, how do I generate z = sin(x+y)? How are the points calculated and drawn? I couldn't find any examples.

推荐答案

https: //threejs.org/docs/#api/en/geometries/PlaneGeometry

类似这样的东西包含顶点.如果顶点由[x,y,z]组成,则可以通过遍历所有顶点在此处应用函数.

Something like this contains vertices. If a vertex consists of [x,y,z] you can apply your function there by looping through all the vertices.

http://aerotwist.com/tutorials/an- Introduction to Shaders-Part-1/

本教程是一个示例,您可以了解如何使用着色器更快地完成相同的操作

this tutorial is an example how you can use shaders to do the same thing MUCH faster

我相信本教程是所有实时3d事物的绝佳起点: http://www.opengl-tutorial.org/beginners-tutorials /tutorial-3-matrices/

I believe that this tutorial is a great starting point for all things realtime 3d: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

这篇关于如何使用three.js绘制自定义3d曲面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆