Explaining transparent material in JSON Model format 3.1

Can anyone provide guidance on how to specify transparent materials in JSON Model format 3.1? I attempted the following JSON code, but it did not work as expected:

 {
    "metadata": {
            "formatVersion" : 3 
    },
    "materials": [{
        "DbgColor" : 15658734,
        "DbgIndex" : 0,
        "DbgName" : "dummy",
        "illumination" : 2,
        "opticalDensity" : 0.5,
        "transparency" : 0.5,
        "colorAmbient" : [ 0.9, 0.1, 0.1 ],
        "colorDiffuse" : [ 0.1, 0.7, 0.1 ]
    }],
    "vertices": [0,0,0, 100,0,0, 100,100,0, 0,100,0 ],
    "normals": [],
    "colors": [1,0,0, 0,1,0 ],
    "uvs": [],
    "faces": [67, 0,1,2,3,0, 1]
}

I have experimented with different values for illumination, optical density, and transparency without success.

Appreciate any help! - Jan

Answer №1

Make sure to include transparent: true and transparency: 0.5. The latter corresponds to the CSS property opacity.

"materials": [  {
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "dummy",
    "transparent" : true,
    "transparency" : 0.5,
    "colorAmbient" : [ 0.9, 0.1, 0.1 ],
    "colorDiffuse" : [ 0.1, 0.7, 0.1 ]
}],

This information applies to three.js version r.60.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What does ngModel look like without the use of square brackets and parenthesis?

Can you explain the usage of ngModel without brackets and parentheses in Angular? <input name="name" ngModel> I am familiar with [ngModel] for one-way binding and [(ngModel)] for two-way binding, but I am unsure what it means when ngModel ...

What is the best way to create and send an array of dictionaries in JSON format to a server using Alamofire in Swift 3?

Trying to send an array of dictionaries in JSON format to Alamofire has been challenging for me. { "attendance": [{ "attndid":"0", "psngrtype": "student", "date":currentdate, "cuid": "25", "enttid": "21", }] } Within a tableview, I a ...

Issue with Nativescript tab view not functioning as expected

I have encountered a bug while manually trying to change tabs. The issue arises when the tab index changes but the tabs themselves do not update accordingly. In order to demonstrate this problem, I have created a NativeScript Playground app where you can ...

Incorporating Redux into Angular 2 with SystemJS loading technique

I have been delving into learning Angular 2 and I am keen on integrating Redux into my project. Currently, I have set up my project using angular-cli on rc2 release. This is my systemjs configuration: /************************************************** ...

Getting a list of connected users on a PeerJS server using Express is simple and straightforward. Follow these steps to

Trying to incorporate PeerJS, a webRTC library, into a game and utilizing their server for user discovery has proven challenging. The goal is to manage a list of connected users, but grappling with the PeerJS server has been difficult. The documentation s ...

What are some solutions for resolving the common issue of encountering a "Failed to parse JSON" error in npm?

Encountering a recurring issue with npm when executing the npm start command in a react project folder after a period of inactivity. Error logs displaying 'Failed to parse json' and 'package.json must be actual JSON, not just Javascript&apo ...

The attempt to use 'readAsArrayBuffer' on 'FileReader' was unsuccessful due to parameter 1 not being of type 'Blob'

I'm encountering an issue with a JavaScript FileReader that is giving me the error message Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'. Below is the snippet of ...

Attempting to relocate various containers

My task involves handling a group of randomly placed boxes on a webpage, each painted in random colors. I am currently attempting to enable their movement from one location to another. Despite being a seemingly simple task, my lack of familiarity with mous ...

Perform an ajax POST call to a server using ajax/jQuery techniques

I am attempting to utilize ajax to send a post request to a different domain and receive a json response. The server is located within my company premises and the logs show that it is indeed sending back a json response. Below are two samples of my attemp ...

JS Issue with Generating Content

Introduction( kind of :) ) Starting with the process of generating 5 coffee beans for each cup of coffee. The coffee class includes a strength attribute, and my goal is to visually distinguish the coffee beans which have a strength greater than the select ...

Failed to interact with the slash command in discord.js version 13

Whenever I try to run the command, I encounter an "interaction failed" error. I need help identifying which file is causing the error and how to resolve it. The issue can be found in index.js: client.commands = new Collection(); const commandFiles = fs.r ...

Is receiving shelter from a different aspect, Cypress

Encountered a timeout error while attempting to select an element with cy.select(). The following element: <select aria-describedby="searchDropdownDescription" class="nav-search-dropdown searchSelect" data-nav-digest="Xa0GQ+pPQ/ ...

Concern with Isotope's masonry feature

I'm at my wit's end! The container div I'm dealing with is 1170px wide. My goal is to fit in 3 divs within this width. The first div is 275px wide, the second is 580px wide, and the third is also 275px wide. Altogether, these divs should ad ...

Create a new array by adding keys and their values to multiple documents

In my collection named inventory, I have multiple documents with values for each document. { "apples": 2 ,"oranges": 3, "carrots": 5 } { "apples": 4, "oranges": 6, "carrots": 9 } How can I combine all the fruits into a single array in multiple documents ...

Converting JSON to CSV and renaming files using command prompt

Need help running a Python command through the command prompt? Here's what I'm trying to do: python "C:\Users\Bhavik\Desktop\Plaid Conversions\json_to_csv.py" accounts "C:\Users\Bhavik\Desktop\New f ...

Determining the optimal route to retrieve the key value in JSON format?

Here is a sample json data: var countryData = { "USA":{ "W": 97.0, "N":42.5, "E": 130.0, "S": 20.0, "vert_%": 170 }, }; While I know how to access the values: var myValue = countryData.USA.W; How can I access a specific key like W or USA? ...

Images displayed alongside webpage contents

I'm having trouble getting these photos to display in the same row. Any suggestions on what I should change? https://i.stack.imgur.com/EbvmR.png I've attempted using float left and other commands, but one picture continues to stay in the lower r ...

Sending data from a PHP array to a JavaScript array

I'm currently working on retrieving my SQL query array, converting it into a JavaScript array, and then displaying the information one by one. Despite finding some helpful posts on this topic, I am still struggling to make it work. As a newcomer to aj ...

After the update, the hues in my THREE.JS project are all out of whack

My project's colors, utilizing fbx models, have become distorted after upgrading to version 136. The colors now appear much darker. The migration guide mentioned: The properties WebGLRenderer.gammaFactor and THREE.GammaEncoding have been removed. If ...

Two separate tables displaying unique AJAX JSON response datasets

As a beginner in javascript, I am facing a challenge. I want to fetch JSON responses from 2 separate AJAX requests and create 2 different tables. Currently, I have successfully achieved this for one JSON response and table. In my HTML, I have the followi ...