threejs
threejs
threejs
Would you like to react to this message? Create an account in a few clicks or log in to continue.


WebGL and Three JS dedicated forum. Here we can discuss about Three JS 3D library.
 
HomeGalleryLatest imagesSearchRegisterLog in

 

 Materials Editor based on Slots

Go down 
AuthorMessage
Admin
Admin
Admin


Posts : 46
Points : 78
Reputation : 3
Join date : 2017-02-06
Location : London, Milan

Materials Editor based on Slots Empty
PostSubject: Materials Editor based on Slots   Materials Editor based on Slots Icon_minitimeFri Feb 24, 2017 10:57 am

I was working on a way to define more materials in one project and I needed to create a kind of simple mat slots. This is the code I created for this purpose: to implement more materials than can be assigned to object at your choise.

Code:

/* HTML input which contains a list of mat numbers */
<div>
<input type="text" class="plastiInput" id="materialSlots">
</div>

/* Javascript function */
/* Declare array */
var materials = [];
/* Numbers of materials in slots */
var maxNumbMat = 8;

var matSlots = document.getElementById('materialSlots');
for (var m = 0; m < maxNumbMat; m++) {
var mat = new THREE.MeshPhongMaterial( {
color: 0xffffff,
shininess: 180,
specular: 0x222222,
shading: THREE.SmoothShading
});
materials.push(mat);
matSlots.value = (matSlots.value + m + ',');
}


Back to top Go down
https://threejs.forumotion.com
 
Materials Editor based on Slots
Back to top 
Page 1 of 1
 Similar topics
-
» How to customize materials through ShaderMaterial ?
» First screenshot of the 3D Editor

Permissions in this forum:You cannot reply to topics in this forum
threejs :: WEBGL and Three JS Library :: Coding and new Examples-
Jump to: