threejs specColor with alpha channel - three.js

i need to import some geometries in my scene with three.js and each one specifies an RGBA color and an RGBA specular color. In threejs there is a problem, because it seems that it handles just RGB colors, with an alpha property for the whole object. But I need two separate values for the alpha: one for the color and one for the specular color.

Related

How to prevent Effectscomposer from breaking material transparency

I have a bunch of planes with a shader material that draws a radial gradient from transparent to a defined color.
As soon as I add an Effectscomponent from drei with an unrealBloomPass, my scene looks like that:
How can I keep the transparency of my materials on each plane?

gltf exported from blender with metallic texture and no roughness texture is loaded into three.js with roughness texture matching metallic texture

If the metallic texture is being reused (same UUID) as the roughness texture and I don't need the roughness texture, would it be more performant to set the roughnessMap as null?
I don't understand why the metallic texture is being reused so an explanation of that would be appreciated as well.
The .metalnessMap uses the blue channel while the .roughnessMap uses the green channel of the same texture. This is done to save filesize and memory, since using a single RGB texture for multiple purposes is more cost-effective than using separate RGB textures.
Ambient occlusion uses the red channel of the assigned texture, so you could potentially have three separate maps for the price of one!

3ds Max -> three.js opacity map

I'm adding an opacity map with an alpha channel to my standard material in my .max file. The opacity map does not work/show after translated into three.js. Properties like texture, color, roughness etc are visible and working. The only problems seems to be with this alpha channel.
Should I follow any extraordinary steps for bringing the opacity map into three.js?
As far as I know SVF doesn't support transparency map. The best you can do to have some transparency is to set the transparency color for physical material or the opacity value for standard material inside of 3ds Max. However, this will apply transparency on your entire material.

Three.js: Dynamically scale/rotate alpha mask-- best practices 2018?

I have a diffuse image and a greyscale alpha mask that work when combined in a material--
map: diffuse image,
alphaMap: greyscale image,
transparent: true
example here--> http://instantplaces.ca/gsap-180606-1/mask-180630-1.html
What is the best way using current three.js to dynamically rotate and/or scale the alpha mask separately from the diffuse image?

SceneKit: Is it possible to cast an shadow on an Transparent Object?

i am trying to cast an shadow on an totally transparent plane in SceneKit on OSX. I am struggling with this problem since several hours and do not come to any solution.
My Purpose is to generate an Screenshot of several objects with an transparent background and just the shadow on an invisible Plane.
Do you have any suggestions for me how i can make this with apples SceneKit?
Do i have to program my own shader, can i make this work with shadermodifiers or can i use built in functionallity?
UPDATE:
I find an alternative solution for anyone who needs:
create a white plane under 3D model, note that the color of plane must be pure white.
set blend mode of plane's material to SCNBlendModeMultiply.
set light model of plane's material to SCNLightingModelLambert.
This works because any color multiply white color (1, ,1, 1) return itself And lambert light model will not take account of directional light, So the plane will always be background color which look like transparent. Another benefit of this solution is you don't need change light‘s shadow rendering mode.
For people who used to inspector of Xcode.
According to SceneKit: What's New.
First, add a plane under you model. Then prevent it from writing to colorBuffer.
Second, change your light model's shadow rendering mode to deferred. Notice that you must use light which can cast shadows.
Oily Guo, your solution works. Here the solution is in code:
Configuration of the light source:
light.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.4)
light.shadowMode = .deferred
And for the floor (ie. SCNFloor underneath your objects):
material.diffuse.contents = UIColor.white
material.colorBufferWriteMask = SCNColorMask(rawValue: 0)
I do not have an answer to your question, however I have a workaround:
Render your scene and keep the image in memory
Change all the materials in your object for pure black, no specular
Change the plane and the sky to a fully white material, lights to white
Render the scene to another image
On the second image, apply the CIColorInvertand CIMaskToAlpha Core Image filters
Using Core Image apply the Alpha Mask to the first render.
You'll get an image with a correct Alpha channel, and transparent shadows. You will need to tweak the materials and lights to get the results you want.
The shadow may become lighter on the edges, and the only way around that is rendering it as yet another image, and filling it with black after the Mask to Alpha step.

Resources