Mapping in-fidelity in quadrilateral rendering
Note how straight lines of the texture are being rendered as zig-zag lines
by Chrisssie
CSS
body {
background-color: #000;
margin: 0px;
overflow: hidden;
}
JavaScript
// Simple three.js example
import * as THREE from "https://threejs.org/build/three.module.js";
import { OrbitControls } from "https://threejs.org/examples/jsm/controls/OrbitControls.js";
import { GUI } from "https://threejs.org/examples/jsm/libs/lil-gui.module.min.js";
var renderer, scene, camera, controls;
let testMesh, testMaterial, testGeometry;
const PI_180 = Math.PI / 180.0;
const points = [];
let wireMaterial, flatMaterial, gouraudMaterial, phongMaterial, texturedMaterial, reflectiveMaterial;
let ambientLight, light;
let parameters;
let shading = '';
let latheSegments = 0;
init();
animate();
//render();
function init() {
// camera
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.set(0, 0, 60);
// renderer
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.outputEncoding = THREE.sRGBEncoding;
document.body.appendChild(renderer.domElement);
// scene
scene = new THREE.Scene();
// controls
controls = new OrbitControls(camera, renderer.domElement);
// light
ambientLight = new THREE.AmbientLight(0x444444);
light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(32, 39, 70);
scene.add( ambientLight );
scene.add( light );
// axes
scene.add(new THREE.AxesHelper(40));
// Textures
const textureEquirec = new THREE.TextureLoader().load( "https://live.staticflickr.com/65535/51613416113_dda7a692f0_o.jpg" );
textureEquirec.mapping = THREE.EquirectangularReflectionMapping;
textureEquirec.encoding = THREE.sRGBEncoding;
const textureMap = new THREE.TextureLoader().load( "https://live.staticflickr.com/65535/51613862444_580840bab6_o.jpg" );
textureMap.wrapS = textureMap.wrapT = THREE.RepeatWrapping;
textureMap.anisotropy = 16;
textureMap.encoding = THREE.sRGBEncoding;
// scene.background = textureEquirec;
// initialize...