Jump to content

Are Decals working in 2.3?


Qbound
 Share

Recommended Posts

Hi all,

 

are the decals working in 2.3? i tried to create a decal but i got a NULL pointer back. And i think i setup the parameters right. hopefully ;)

 

here is the code

	// Create the pick
TPick _Pick;

// get the ground of the mesh
LinePick( &_Pick, m_vPositionCurrent, Vec3( m_vPositionCurrent.X, m_vPositionCurrent.Y -10, m_vPositionCurrent.Z ),0 ,1 );

// Create the ground decal
m_MeshDecal				= CreateDecal( _Pick.surface, m_vPositionCurrent, 2, 32 );
m_matDecal				= LoadMaterial( "abstract::SFX_DECAL_WAKE.mat" );	PaintEntity( m_MeshDecal, m_matDecal );

 

m_vPositionCurrent is the current position of the player and it is set correct. It has an offset of 2 and the linepick gave me a surface back.

I do not understand what the parameter at the end of the createdecal is. so far with searching the forum (old one) most used 32 a change of this parameter has no effect at all.

 

cu

Oliver

Windows Vista 64 / Win7 64 | 12GB DDR3 1600 | I7 965 | 2 * 280GTX sli | 2 * 300GB Raptor | 2 * 1.5TB

Link to comment
Share on other sites

They haven't worked since some versions ago...

 

 

I've not tried since 2.27 and finding they did not work, but hasn't Tyler got decals working (or something similar) in his weaponwerks project?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Yes, I do have decals working.

 

Here is my code to create a decal:

 

if (pick.surface~=nil) then
			SetWorld(fw.transparency.world)
			decal = CreateDecal(pick.surface,TFormPoint(pick.position,nil,pick.entity),1.0/16.0,64)
			SetWorld(fw.main.world)				
			if (decal~=nil) then
				decal:SetParent(pick.entity,0)
				--decal:Paint(LoadMaterial("abstract::bullethole.mat"))
				decal:Paint(GetImpactDecal(GetMeshModel(pick.entity)))

				decal:SetColorf(1.0,1.0,1.0,bullet.damage/bullet.initialdamage)
			end
		end

 

You can ignore the SetColorf and GetImpactDecal stuff, those are things for Weaponwerks for the dynamic impact system, and to set the alpha of the decal based on how much damage the bullet has inflicted relative how much it could in perfect conditions.

 

For CreateDecal from a pick, you need to pass the surface, the transformed pick position from world to entity space, the radius (1/16.0 is what Josh used by default and makes a nice, though slightly too big bullet hole), and 64 is the max tris (the higher this is, the better the decal can align to the surface).

 

The transparency world and decal:SetParent calls are key in order to make sure it is visible and sticks to the surface.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Thanks for the help. Ill try this out. At the moment i think the problem is that i do not hit a surface and there for there is no decal created.

 

btw. why you don't use 0.0625 as the 3rd parameter. it will be faster then everytime a devision.

 

cu

Oliver

Windows Vista 64 / Win7 64 | 12GB DDR3 1600 | I7 965 | 2 * 280GTX sli | 2 * 300GB Raptor | 2 * 1.5TB

Link to comment
Share on other sites

Hmm, ok, maybe they were fixed, or everyone who tried before did something wrong.

 

 

I never got them working in 2.24 to 2.27 I then gave up, but I noticed them working in one of Tylers vids where he is going "Postal" on some lockers.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

The material file was a straight up copy from the last version of the SDK that had shot1.mat or whatever. I think 2.25.

 

Here is the material file:

 

texture0="abstract::shot1.dds"
shader="abstract::mesh_diffuse.vert","abstract::mesh_diffuse_alphatest.frag"

alphatest=1
blend=mod2x
depthmask=0
//normalmask=0
overlay=1
clamp0=1,1
castshadows=0

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Are you creating the decal in the transparency world?

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

That is strange, because I don't get that at all.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

That is strange, because I don't get that at all.

 

Ive always had this problem... and I remember others posting about this on the old forum but I can't seem to find those posts...

 

yep, I am creating the decal in the transparency world... using your code! B)

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Many things in Editor stop randomly working from time to time. Then you can close all programs and suddenly they work again.

Just had emitters stop working on firepit and a new emitter, but on one scene they worked, it's totally wierd B)

I blame programming languages with garbage collection (like BlitzMax), as they allow the programmer to make randomly working code, since they don't crash each time when the programmer makes a mistake, and that's bad.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

  • 1 month later...

When using decals and Gamelib, I don't seem to be able to get the decal to show, any thoughts?

 

if (pick.surface != NULL)
{
SetWorld( scene->framewerk.transparency.world);
TMesh decal = CreateDecal(pick.surface,TFormPoint(Vec3(pick.X,pick.Y,pick.Z),NULL,pick.entity),10.0,64);
SetWorld( world );	
if(decal != NULL)
{
	EntityParent(decal,pick.entity,0);
	PaintEntity(decal,LoadMaterial("abstract::bullethole1.mat"));    
	EntityColor(decal,Vec4(1.0,1.0,1.0,1.0));
}
}
SetWorld( world );	

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

I think you need to have the position non-transformed first, I had to experiment with variations of the position code in my particular implementation because I modify entity positions and undo them, hence all the transforms I have.

 

I would try just placing the decal at 0,0,0 on an entity, then try 0,0,0 transformed between various spaces.

 

Hope that helps!

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

I would try just placing the decal at 0,0,0 on an entity, then try 0,0,0 transformed between various spaces.

 

Hope that helps!

 

Yes it does, after reading this thread and then having a problem I wasn't sure if my code was correct... but I suspected that position may have been the case, when doing this in GDK, I used to start my decal as a box, position is on the object and then see were it was positions, but they did not have a special DECAL class, you had to use a plane....

 

Anyway thats for the suggestions..

If it's not Tactical realism then you are just playing..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...