≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Wow I got plain Vertex Alpha working
Posted by:
(you are not logged in)
Enter the missing letter in: "Internati?nal"
(you are not logged in)
Text:
[quote][b]csp-games[/b] wrote: Additional note: apparently, when a mesh is using no realtime dynamic light, the alpha range is as described above from 0 to 63, but when it's dynamically lit, then the range goes from 0 to 255. So you have to tweak it so it does take that difference into consideration. I use an optional parameter is_dyn_lit [code] function EntityAlpha(node2,al,is_dyn_lit=0){ var node=node2.getMesh(); if(!node)alert("sum ting wong"); //var mes=node.GetMesh(); buf=node.GetMeshBuffers(); if(is_dyn_lit==1) {al*=4;} al*=63; if(al<0)al=0; if(al>255)al=255; al=al<<24; // bit-shifting alpha to the top byte. var al_max=0x3e000000; if(is_dyn_lit==1) {al_max=0xfe000000;} for(i=0; i<buf.length;i++){ if(al>al_max){ if(is_dyn_lit==0) {buf[i].Mat.Type = CL3D.Material.EMT_SOLID;} else {buf[i].Mat.Type = CL3D.Material.EMT_TRANSPARENT_ALPHA_CHANNEL_REF;} // this is used for dyn. lit plants and such } else{ buf[i].Mat.Type = CL3D.Material.EMT_TRANSPARENT_ALPHA_CHANNEL; } for(j=0; j<buf[i].Vertices.length;j++){ buf[i].Vertices[j].Color=(al | 0x3f3f3f);//0x3f3f3f); } buf[i].update(false,false); } } [/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact