Question

In: Computer Science

Using Vue software provide two rendered objects in which at least five (5) of the following...

Using Vue software provide two rendered objects in which at least five (5) of the following techniques are realized.

Sphere , Materials , Point Lighting , Spot Lighting , Directional Lighting , Ambient Lighting , Recursive Depth , Soft Shadow , Transparent Object , Depth of Field , Motion Blur , Texture Mapping and3D Transformation

There is no restriction on what techniques you choose to demonstrate, nor on the scene you choose to develop, but you must submit the following.

  • A still rendered image, provided as a *.jpg or *.tiff file

Solutions

Expert Solution

Here's the implimentation of Sphere, Materials, Recursive Depth, Transparent Onject, Texture Mapping and3D Transformation. VueJS Compiler is used. Before we need to install some libraries, the commands to be executed for them are,

import * as THREE from 'three'//Sphere

import BaseInput from "./components/BaseInput" //For Transparent Object.

import TreeMenu from './TreeMenu.vue' // Recursive depth in tree

import Vue from 'vue' // Materials import 1

import { MdButton, MdContent, MdTabs } from 'vue-material/dist/components' // Material import 2

import 'vue-material/dist/vue-material.min.css' // Material Import 3

import 'vue-material/dist/theme/default.css'   // Material Import 4

<template> // Spotlight

<v-spotlight background="'***"></v-spotlight>

</template>

<script>

import VSpotlight from 'v-spotlight';

export default {

components: {

    VSpotlight,

},

};

</script>

Vue.use(MdButton);///materials

let tree = {

...

}

new Vue({

el: '#app',

data: {

    tree

},

components: {

    TreeMenu

}

})

function avg(arr) {

return arr.reduce((total, num) => total + num, 0) / arr.length;

}

// Static things that won't change

let geometry = new THREE.BoxGeometry( 2, 2, 2 );

let material = new THREE.MeshNormalMaterial();

export class WebGlHelper {

frames = Array(60).fill(0); // for smoothing out FPS counter

frame = undefined; // for tracking the current frame

boxes = []; // references to all meshes

scene = new THREE.Scene();

light = new THREE.DirectionalLight(0xffffff, 1);

camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );

constructor({ container, onFPSUpdate, }) {

    this.element = container;

    this.onFPSUpdate = onFPSUpdate;

    // fov, ratio, zNear, zFar

    this.camera.position.set(0, 0, 3.2);

                        this.light.position.set( -5, 0, -10 ).normalize();

    this.scene.add(this.light);

    this.renderer = new THREE.WebGLRenderer( { alpha: true, antialias: false } );

    this.renderer.setSize( window.innerWidth, window.innerHeight );

    this.element.appendChild(this.renderer.domElement);

    this.animate = this.animate.bind(this);

}

syncBoxes(rotations) {

    let diff = this.boxes.length - rotations.length;

    let boxesHaveMore = diff > 0;

    let boxesHaveLess = diff < 0;

    let same = diff === 0;

    // console.log({ diff, same, boxesHaveLess, boxesHaveMore });

    if (same) return;

    if (boxesHaveLess) {

      for (let i = 0; i < 0 - diff; i++) {

        let rotation = rotations[i];

        this.addBox(rotation);

      }

      return;

    }

    if (boxesHaveMore) {

      for (let i = 0; i < diff; i++) {

        let box = this.boxes.pop();

        this.scene.remove(box);

      }

      return;

    }

    console.error('math error');

}

addBox(rotation) {

    let mesh = new THREE.Mesh(geometry, material);

    mesh.rotation.set(...rotation);

    this.scene.add(mesh);

    this.boxes.push(mesh);

}

animate() {

    let last = Date.now();

    let boundCallback;

    function loop() {

      this.frame = requestAnimationFrame(boundCallback);

      for (let i = 0; i < this.boxes.length; i++) {

        let box = this.boxes[i];

        box.rotation.x += 0.01;

        box.rotation.y += 0.01;

        box.rotation.z += 0.01;

      }

      this.renderer.render(this.scene, this.camera);

      const now = Date.now();

      const elapsed = now - last;

      this.frames.shift();

      this.frames[frames.length] = 1000 / elapsed;

      this.onFPSUpdate(Math.round(avg(this.frames)));

      last = now;

    }

    boundCallback = loop.bind(this);

    this.frame = requestAnimationFrame(boundCallback);

}

willDestroy() {

    cancelAnimationFrame(this.frame);

}

<div id="app">

<tree-menu :label="tree.label" :nodes="tree.nodes"></tree-menu>

</div>

<div class="shadow z-depth-5"></div> // For Shadow
 

}

import * as THREE from 'three'//Sphere

import BaseInput from "./components/BaseInput" //For Transparent Object.

import TreeMenu from './TreeMenu.vue' // Recursive depth in tree

import Vue from 'vue' // Materials import 1

import { MdButton, MdContent, MdTabs } from 'vue-material/dist/components' // Material import 2

import 'vue-material/dist/vue-material.min.css' // Material Import 3

import 'vue-material/dist/theme/default.css'   // Material Import 4

<template> // Spotlight

<v-spotlight background="'***"></v-spotlight>

</template>

<script>

import VSpotlight from 'v-spotlight';

export default {

components: {

    VSpotlight,

},

};

</script>

Vue.use(MdButton);///materials

let tree = {

...

}

new Vue({

el: '#app',

data: {

    tree

},

components: {

    TreeMenu

}

})

function avg(arr) {

return arr.reduce((total, num) => total + num, 0) / arr.length;

}

// Static things that won't change

let geometry = new THREE.BoxGeometry( 2, 2, 2 );

let material = new THREE.MeshNormalMaterial();

export class WebGlHelper {

frames = Array(60).fill(0); // for smoothing out FPS counter

frame = undefined; // for tracking the current frame

boxes = []; // references to all meshes

scene = new THREE.Scene();

light = new THREE.DirectionalLight(0xffffff, 1);

camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );

constructor({ container, onFPSUpdate, }) {

    this.element = container;

    this.onFPSUpdate = onFPSUpdate;

    // fov, ratio, zNear, zFar

    this.camera.position.set(0, 0, 3.2);

                        this.light.position.set( -5, 0, -10 ).normalize();

    this.scene.add(this.light);

    this.renderer = new THREE.WebGLRenderer( { alpha: true, antialias: false } );

    this.renderer.setSize( window.innerWidth, window.innerHeight );

    this.element.appendChild(this.renderer.domElement);

    this.animate = this.animate.bind(this);

}

syncBoxes(rotations) {

    let diff = this.boxes.length - rotations.length;

    let boxesHaveMore = diff > 0;

    let boxesHaveLess = diff < 0;

    let same = diff === 0;

    // console.log({ diff, same, boxesHaveLess, boxesHaveMore });

    if (same) return;

    if (boxesHaveLess) {

      for (let i = 0; i < 0 - diff; i++) {

        let rotation = rotations[i];

        this.addBox(rotation);

      }

      return;

    }

    if (boxesHaveMore) {

      for (let i = 0; i < diff; i++) {

        let box = this.boxes.pop();

        this.scene.remove(box);

      }

      return;

    }

    console.error('math error');

}

addBox(rotation) {

    let mesh = new THREE.Mesh(geometry, material);

    mesh.rotation.set(...rotation);

    this.scene.add(mesh);

    this.boxes.push(mesh);

}

animate() {

    let last = Date.now();

    let boundCallback;

    function loop() {

      this.frame = requestAnimationFrame(boundCallback);

      for (let i = 0; i < this.boxes.length; i++) {

        let box = this.boxes[i];

        box.rotation.x += 0.01;

        box.rotation.y += 0.01;

        box.rotation.z += 0.01;

      }

      this.renderer.render(this.scene, this.camera);

      const now = Date.now();

      const elapsed = now - last;

      this.frames.shift();

      this.frames[frames.length] = 1000 / elapsed;

      this.onFPSUpdate(Math.round(avg(this.frames)));

      last = now;

    }

    boundCallback = loop.bind(this);

    this.frame = requestAnimationFrame(boundCallback);

}

willDestroy() {

    cancelAnimationFrame(this.frame);

}

<div id="app">

<tree-menu :label="tree.label" :nodes="tree.nodes"></tree-menu>

</div>

<div class="shadow z-depth-5"></div> // For Shadow
 

}


Related Solutions

Using this knowledge of the parent company, identify at least FIVE (5) ways in which the...
Using this knowledge of the parent company, identify at least FIVE (5) ways in which the organisation’s competitors might be able to differentiate or diversify, in order to compete effectively.
Identify at least five (5) of the more popular options for entry into international markets? Provide...
Identify at least five (5) of the more popular options for entry into international markets? Provide a brief explanation of each strategic option, and a real-world example of its use.
Considering the past two lessons looking at spreadsheet software, provide at least one example of how...
Considering the past two lessons looking at spreadsheet software, provide at least one example of how you think Excel has transformed virtually all departments within companies (or the business landscape at large)?
Describe at least five (5) ways in which biology influences human behavior.
Describe at least five (5) ways in which biology influences human behavior.
Select two items for which to consider value engineering, and provide at least two alternatives for...
Select two items for which to consider value engineering, and provide at least two alternatives for each on the basis of actual items on a warehouse building?
Using a family planning example, provide at least five tax planning strategies to defer estate tax,...
Using a family planning example, provide at least five tax planning strategies to defer estate tax, gift tax and income tax ( U.S.)
Match each of the following transactions to the journal in which it would be entered. Rendered...
Match each of the following transactions to the journal in which it would be entered. Rendered services on account Received payment from customer on account Received cash from the bank in exchange for a note payable Purchased supplies on account Paid vendor on account Withdrew cash for personal use (by owner) Withdrew supplies from the business for personal use (by owner) Journalized the adjusting entry for supplies used during the period Recognized depreciation on the building Closed the revenue account...
Research, list and explain at least five advantages and five disadvantages of using CAATs
Research, list and explain at least five advantages and five disadvantages of using CAATs
I) A company bills customers for services rendered on account. Which of the following is part...
I) A company bills customers for services rendered on account. Which of the following is part of recording this transaction? a) Decrese service revenue b) Decrease cash ; c) Increase account receivable ; d) Increase Unearned revenue II) Adjusting entries always impact the income statement and the cash account True or False? III) Denise's Donuts has 12 Employees who are paid $15 per houir. At December 31, 2016, each of Denise's Donuts's employees had worked 20 hours which had not...
Write a paragraph or two about which of five software architecture patterns (Layered Architecture, Event Driven...
Write a paragraph or two about which of five software architecture patterns (Layered Architecture, Event Driven Architecture, Microkernel Architecture, Microservices Architecture Pattern, and Space-Based Architecture) would be best given each scenario. Indicate which pattern would be used to implement the system and why it is the best choice. Use descriptions of how the various architectural characteristics apply to this system and pattern to support your decision as needed. The first system in question is a set of software drivers and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT