Jump to content

Recommended Posts

Posted

So i am trying to make some bulletholes. I made it just like in Leadwerks documents, but i got "Compile error Unable to convert from 'TEntity' to 'TMesh'.

am.bullethole:TMesh = CreateDecal(spick.surface, TFormPoint(Vec3(spick.X, spick.Y, spick.Z), Null, spick.entity), 20.0/16.0, 32)
EntityParent(am.bullethole , spick.entity, 0)
PaintEntity(am.bullethole , LoadMaterial("abstract::fire.mat"))
addMesh(am.bullethole, spick.entity)
updatemesh(am.bullethole)

 

Error is pointing me to AddMesh line and i understand error, but without addmesh there is no bulletholes.

 

I followed this document:

http://www.leadwerks...tle=CreateDecal

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

Like this?

addMesh(am.bullethole, TMesh(spick.entity))

(No bulletholes, but no errors when compiling)

 

And another question is how do i check if picked entity is suitable for decals to it's surface? Because now it's crashing when "shooting" to ground.

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

When I first saw the name of the thread I thought it said "butthole decals"...

Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D

Posted

When I first saw the name of the thread I thought it said "butthole decals"...

Thats what got your attention? :D

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

Is there example for me to take a look?

 

 

Have you tried .... searching the forum for "CreateDecal" or even just "Decal"?

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"

Posted

Okay... So i got bulletholes working with 'planes'. Only problem is that bullethole materials behave strangely. From far bulletholes is blue, little bit closer, bullethole texture is stretched oddly. Near bullethole material is right, but no masking.

Is it even possible to make round bulletholes with planes?

 

Here is my bullethole solution:

am.bullethole = Createplane()
Scaleentity(am.bullethole, Vec3(.0625,.0625,.0625))
PaintEntity(am.bullethole, LoadMaterial("abstract::bullethole.mat"), 1)
entityParent(am.bullethole, spick.entity)
Positionentity(am.bullethole, spick.position, 1)
AlignToVector(am.bullethole, spick.normal,2,1)
EntityViewRange( am.bullethole, VIEWRANGE_NEAR)
am.timer = MilliSecs()

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

  • 1 month later...
Posted

Okay... Bumping this topic up...

 

Looks like planes are not good for this, so i am still struggling with this thing. I tried it again with decals with this code:

am.bullethole = CreateDecal(spick.surface, TFormPoint(Vec3(spick.X, spick.Y, spick.Z), Null, spick.entity), 20.0/16.0, 32);
EntityParent(am.bullethole , spick.entity, 0);
PaintEntity(am.bullethole , LoadMaterial("abstract::bullethole.mat"),1)
AddMesh(am.bullethole, TMesh(spick.entity))

 

And what happens is this:

lolmo.png

 

 

So... It paints the surface black. Not what i am trying to do. Ideas?

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

Still not working that way.

 

When i look painted wall closely i see this:

bulletholes.png

 

Looks like it's painting entire surface with bulletholes. Closely there is bulletholes, little bit further wall is blue. And far, wall is black.

Help is appreciated.

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

Still not working. Now bulletholes can't be seen even in close range. Now it's grey when close to "bullethole".

 

Edit:

I made little bit changes to .mat file and now i got this.

bullethole.png

 

When i shot to wall it makes bullethole where i hit, but paints entire surface. (black from far, blue from near) When second bullet hits wall. It makes the same, but i think it paints over the earlier bullethole.

 

mat file looks like this:

texture0="abstract::bullethole.dds"
zsort=1
overlay=1
clamp0=1,1,0
clamp1=1,1,0

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

I am not programming with LUA, but here is BMax code:

am.bullethole = CreateDecal(spick.surface, TFormPoint(Vec3(spick.X, spick.Y, spick.Z), Null, spick.entity), 20.0/16.0, 32);
EntityParent(am.bullethole , spick.entity, 0)
PaintEntity(am.bullethole , bulletholeMat)
AddMesh(am.bullethole, TMesh(spick.entity))

 

And here is .dds and .mat files:

http://www.mediafire...6qpqibdxq68qqx6

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

Here is working example.

 

Material file:

texture0="abstract::bullethole.dds"
shader="abstract::mesh_diffuse_bumpmap.vert","abstract::mesh_diffuse_bumpmap.frag"
overlay=1
blend=alpha
zsort=1
clamp0=1,1,0
clamp1=1,1,0

 

LUA-code:


bulletholeMat = LoadMaterial("abstract::bullethole.mat")

 

picked = CameraPick(camera, Vec3(GraphicsWidth() / 2, GraphicsHeight() / 2, 100), 0);

bullethole = CreateDecal(picked.surface, TFormPoint(picked.position, nil, picked.entity), 1.0/16.0, 32);

 

EntityParent(bullethole, mesh, 0)

PaintEntity(bullethole, bulletholeMat)

AddMesh(bullethole, picked.entity)

FreeEntity(bullethole)

 

And video:

 

LUA-script and files in attachment.

Bullethole 2012-10-06.rar

  • Upvote 5
Posted

Excellent example daimour, your tutorials are really clear and well constructed.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Posted

Thanks Daimour, but here is still problem.

 

erroru.png

 

It is pointed to this line:

 

AddMesh(am.bullethole, spick.entity)

 

If i change it to this:

 

addMesh(am.bullethole, TMesh(spick.entity))

 

 

No error, but no bulletholes either. :/

Is this Blitzmax bug or what?

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

1. Check type of your picked entity. It can be animated model with LODs or terrain or vegetation or something else. You need to drill down to real mesh.

 

2. Try to not add decal to mesh for awhile. Leave it as separate entity.

Posted

Decals work in blitzmax... well, at least as well as any other language using LE decals that drag down the FPS whenever multiple ones are used...

 

Two issues that I could see that might be causing an issue for you:

1) Make sure you use the decal texture Daimour returned in his example as it was a power of 2 and the original one you provided was not.

2) In the material file Daimour provided he is using a bumpmap shader, but yet there is no bumpmap assigned. This can cause issues as sometimes the last bumpmap will be used from another model. My suggestion is to either remove the bumpmap reference in the shader assignment or create a bumpmap and assign it in the material file.

 

Other than that, I can only assume its your code. Rather than wasting your time just posting snippets, make a small example and post it. It removes the problem with people having to guess whether there is another problem in your code that is causing the problem and it allows people to quickly test it without having to resort to building their own example.

 

bulletholeBMX.zip

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

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

Looks like bulletholeMat variable was empty. After fixing, it now paints model faces blue. :/

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

Posted

I was writing message while you posted it. Now it's kind of working

holes.png

 

 

What are those black lines coming top of the hole?

 

And how can i get those holes working on picked entity?

Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax

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.

×
×
  • Create New...