Product Chat / Entity Transparency

Author
Message
Sparrowhawk
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 12th Apr 2011
Location: Planet Magrathea
Posted: 8th Jun 2014 15:15
Should the transparency setting work on any entity?
If so whats the range supposed to be?
I'm trying to make some entities see through, and have tried 10,100,1000,10000 - all to no effect.

Any ideas why this doesn't work?

Mac Pro 2014, Windows 8.1 Pro, OSX Mavericks. 3.7Ghz Quad Xeon CPU, Dual AMD D500 GPU's (6GB GDDR5 VRAM), 12GB System RAM, 512 GB PCI-E SSD
Uman
GameGuru TGC Backer
19
Years of Service
User Offline
Joined: 22nd Oct 2004
Location:
Posted: 8th Jun 2014 15:51 Edited at: 8th Jun 2014 15:53
Well it can work but you need to make a .dds texture file that will work correctly I have found myself.



For anyone having problems with transparency for things like glass in windows this is what I have done to get my transparencies to work and its easy :



I use Paint.net :



Open a texture or make a new one at the size you need. Whatever get yourself the texture you need to be transparent. Yes.



Now with the texture open use the square marquee select tool to select the whole texture in this case and select it all and then select "Cut" to place it on the clipboard and then "Paste to paste it back into the now empty background image as a floating "Layer" object. Yes



Now go to menu at top and choose "Layer Properties" and you will see there is a "Transparency value slider" that you can adjust accordingly and watch the image become transparent as to your preference.



Now save the image as a .dds for use in Reloaded on a terrain or entity or alike. Thats. Will only take about a minute to make an image transparent.



Once saved I suggest you close the image and then open it again to check it is OK and still transparent. It should be as if you don't flatten it purposefully it will still be seen to be a floating transparent Layer.



You can save it as DTX1 if you want to keep its memory use as low as possible unless you need another .dds format for any specific purpose. Works perfectly for me anyway.



See attached screen shot. The ice has just enough transparency applied so the player can see the terrain and water below when walking over it.



Hope that helps



Attachments

Login to view attachments
tomjscott
User Banned
Posted: 8th Jun 2014 16:16
@Uman, so what exactly are the ranges then for the transparency setting in the fpe file? Is it 0-100?

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVI
Sparrowhawk
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 12th Apr 2011
Location: Planet Magrathea
Posted: 9th Jun 2014 04:36
Thanks for the info Uman, I'll try this later, I'm working on a side project in VS2013 for the next few days so reloaded aside!

Mac Pro 2014, Windows 8.1 Pro, OSX Mavericks. 3.7Ghz Quad Xeon CPU, Dual AMD D500 GPU's (6GB GDDR5 VRAM), 12GB System RAM, 512 GB PCI-E SSD
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Jun 2014 13:19
It is zero or one. Zero for no transparency....the rest I'll let you figure out

PC SPECS: Windows 7 Ultimate 64-bit, Intel Core i7 920 (PASSMARK:5008), NVIDIA Geforce 9600 GT GPU (PASSMARK:752) , 6GB RAM

Jerry Tremble
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 10th Jun 2014 05:26 Edited at: 10th Jun 2014 05:29
I was never very good at applied math. Just kidding! I use GIMP, add an alpha channel, set color to transparency, and export as .dds, can't remember the specific type of .dds compression, but I think the one with alpha component is what I use. I have never changed that setting in the fpe, just noticed it recently. I still get transparency anyway.







MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
tomjscott
User Banned
Posted: 10th Jun 2014 05:30
Quote: "It is zero or one. Zero for no transparency....the rest I'll let you figure out "


Thanks to Dave, I don't have to figure it out. Seriously? This is the kind of support you offer for your software? I have to figure it out?

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007
Sparrowhawk
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 12th Apr 2011
Location: Planet Magrathea
Posted: 10th Jun 2014 05:37
Thanks for the info everyone
I think I assumed it would be 0 to 100 as that's how opacity works in paint software I use. 0 or 1 makes sense.

Quote: "Seriously? This is the kind of support you offer for your software? I have to figure it out?"

I suspect as we progress a features guide will be put together, at the moment we're simply better off asking, since a lot of this is old X9 stuff that may be swapped out as the engine progresses, no point in rewriting the guide a load of times.

I believe in this instance Lee was just referring to figuring out a 1 meant opposite to the 0, which wasn't too hard for me, even at 4am

Mac Pro 2014, Windows 8.1 Pro, OSX Mavericks. 3.7Ghz Quad Xeon CPU, Dual AMD D500 GPU's (6GB GDDR5 VRAM), 12GB System RAM, 512 GB PCI-E SSD
Jerry Tremble
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 10th Jun 2014 05:50 Edited at: 10th Jun 2014 06:13
Lol! 1 or 0 are the only choices. Transparency on, transparency off. (I think Lee was being funny)

MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 10th Jun 2014 13:00
Not a very good joke I grant you

For clarity, I refer you to a proper description of 0 and 1 in respect of the TRANSPARENCY flag in the FPE file system: http://en.wikipedia.org/wiki/Boolean

The layman only need know these two states to control whether transparency is applied to the entity, however in order to provide a complete break-down of the magic behind the curtain, here is the DBA code that picks up the value:

tryfield$="transparency"
if field$=tryfield$ then entityprofile(entid).transparency=value1

And the code which will use that value:

rem Set any entity transparency
if entobj>0
set object transparency entobj,entityprofile(entid).transparency
endif

And for the avoidance of doubt, here is the C++ code which is called as a result:

DARKSDK_DLL void SetTransparency ( int iID, int iTransparency )
{
// Transparency Modes
// 0 - first-phase no alpha
// 1 - first-phase with alpha masking
// 2 and 3 - second-phase which overlaps solid geometry
// 4 - alpha test (only render beyond 0x000000CF alpha values)
// 5 - water line object (seperates depth sort automatically)
// 6 - combination of 3 and 4 (second phase render with alpha blend AND alpha test, used for fading LOD leaves)
// 7 - very early draw phase no alpha

// check the object exists
if ( !ConfirmObjectInstance ( iID ) )
return;

// new transparency mode
SDK_BOOL bTransparency=TRUE;
if ( iTransparency==0 ) bTransparency=FALSE;
if ( iTransparency==7 ) bTransparency=FALSE;

// apply setting to all meshes
sObject* pObject = g_ObjectList [ iID ];
for ( int iMesh = 0; iMesh < pObject->iMeshCount; iMesh++ )
{
SetTransparency ( pObject->ppMeshList [ iMesh ], bTransparency==TRUE );
SetAlphaTest ( pObject->ppMeshList [ iMesh ], 0x0 );
if ( iTransparency==4 || iTransparency==6 )
{
SetAlphaTest ( pObject->ppMeshList [ iMesh ], 0x000000CF );
}
}

// apply transparency as object overlay
SetObjectTransparency ( pObject, iTransparency );
}

Which of course leads us down into the core object manager of the engine, which shows this:

DARKSDK_DLL void SetObjectTransparency ( sObject* pObject, int iTransparency )
{
// promote to overlay layer (or not)
if ( iTransparency==2 || iTransparency==3 || iTransparency==5 || iTransparency==6 )
pObject->bTransparentObject = true;
else
pObject->bTransparentObject = false;

// new feature - create a water line (for two layers of depth sorted objs above and below line)
if ( iTransparency==5 )
pObject->bTransparencyWaterLine = true;
else
pObject->bTransparencyWaterLine = false;

// transparency mode 7 sets an object to very early draw phase
if ( iTransparency==7 )
pObject->bVeryEarlyObject = true;
else
pObject->bVeryEarlyObject = false;

// overlay flag handling
UpdateOverlayFlag ( pObject );
}

I appreciate the flag names are not entirely self-explanatory, so I invite you to explore the full DBP Engine Source Code at this location: https://code.google.com/p/darkbasicpro/

If there is any more information you require on the functionality of the TRANSPARENCY field in the FPE file, please do not hesitate to ask. I am here to serve (when not coding)

PC SPECS: Windows 7 Ultimate 64-bit, Intel Core i7 920 (PASSMARK:5008), NVIDIA Geforce 9600 GT GPU (PASSMARK:752) , 6GB RAM

tomjscott
User Banned
Posted: 10th Jun 2014 15:36
Thanks, Lee. That's more what I would expect. Sorry if I didn't take your remark as a joke. It wasn't particularly funny to me.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007

Login to post a reply

Server time is: 2024-05-07 08:46:08
Your offset time is: 2024-05-07 08:46:08