Transparency when using material (and light)
Hey guys,
I want to change the transparency of one mesh while using light. As far as I know I need to use material when I want to use light but In case material can be avoided then I would be happy only with a light because I am working with lines and points that are only black and white colour.
So my solution uses material object and I found a solution here on the forum to change a colour of a single mesh (using texture object so that loaded material file doesn't override colour attributes of the mesh). However this option does not allow me to control transparency. I have blend enabled, depth disabled, layer set to 10...
Beside controlling the transparency I want the light also to emit light equally in all directions like a glowing ball. When using material editor I can achieve that by tweaking some light parameters. However when using some png file for texture object the light is emitting light only downwards and not all around it. I have no idea how to fix that with texture/png solution.
This patch shows what I want to achieve (+ of course I want to control transparency of both meshes individually):
Hi T
would something like this be what you're looking for ?
Hey Phiol that is a very beautiful work, much appreciated, a lot for me to learn here. However it unfortunately does not work for me. The reasons for that are:
- light is not emitting light in all directions as it has some angle (I don't know how to make a point light behave as an actual point light without using material). The reason I was mentioning radiating ball was only to stress out that I need light in all directions. My goal is to use point light source to travel around and inside some multilayered mesh wireframe and reveal shape/geometry little by little. However the sphere in your patch looks very sexy and I might use that trick some other time.
- if I don't connect material to mesh I get only 20fps on my laptop. Its a late retina 2013 macbook pro with NVIDIA graphic cards that is "not optimized to perform fixed-function shading" (quoting Rob Ramirez from benchmark topic). Any other as cheap as possible programmable shaders I could use instead of material to get my fps back?
Thanks for the comment , sorry it's not suiting for your situation.
Yes in your case it's a good idea to use jit.gl.materials. As it uses the shader pipeline
have you looked @ the multi-light example in the jitter help render example
here it is with rotation .
@type point does emit light in all direction.
also, if you're on max 7, and retina
use @high_res 1 in jit.gl.render
and your @fsaa 1 goes in the jit.window.
as for alpha transparency with jit.gl.materials,
here is how it's done.
The problem is that when you replace gridshape objects with noise point mesh the point light does not work any more as expected (at least for a user with bad technical knowledge about shaders & co). I added a point mesh in your patch (see below) and if you disable jit.gl.multiple you will see that upper side of point cloud is in total darkness. In the patch attached in my first post I managed to get around that by tweaking some light parameters of jit.gl.material (that is why I attached the material file) but that is not an option any more because I need transparency. Now if I would avoid material I could also turn autonormals on (and use some "invisible" shader for better framerate) which would made the upper picture visible but when you apply that to a dense mesh from the first patch that I posted the result is messy and not visually pleasing (see attached picture). I am attaching also a picture when using material (hence from the first patch).
Thanks for your help Phiol!
I guess I found the solution. Rendering desired mesh to a node and processing it with cc.brightness.ip.jxs to control alpha. It works for what I need. Thanks again Phiol because without your help I would never thought of that!
PS: material file is attached in the first post
PS: However, I would really appreciate if anyone could explain why such a difference between attached two pictures or why light works so differently in examples above. Why did I need to faff around with material to get that nice point light effect in a noise mesh in the first place and why I can not achieve this by simply enabling the light.?