Arska134 Posted August 1, 2012 Share Posted August 1, 2012 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 Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Josh Posted August 2, 2012 Share Posted August 2, 2012 Cast the entity to a mesh: TMesh(entity) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Arska134 Posted August 2, 2012 Author Share Posted August 2, 2012 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. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted August 4, 2012 Author Share Posted August 4, 2012 Is there example for me to take a look? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Benton Posted August 5, 2012 Share Posted August 5, 2012 When I first saw the name of the thread I thought it said "butthole decals"... Quote 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 Link to comment Share on other sites More sharing options...
Arska134 Posted August 5, 2012 Author Share Posted August 5, 2012 When I first saw the name of the thread I thought it said "butthole decals"... Thats what got your attention? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Marleys Ghost Posted August 5, 2012 Share Posted August 5, 2012 Is there example for me to take a look? Have you tried .... searching the forum for "CreateDecal" or even just "Decal"? Quote 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 More sharing options...
Arska134 Posted August 8, 2012 Author Share Posted August 8, 2012 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() Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted September 27, 2012 Author Share Posted September 27, 2012 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: So... It paints the surface black. Not what i am trying to do. Ideas? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
AggrorJorn Posted September 27, 2012 Share Posted September 27, 2012 Try loading the material to a variable. That way the programm doesn´t have to search the material everytime you create a bullethole. TMaterial bulletMaterial = LoadMaterial("abstract::bullethole.mat"); Quote Link to comment Share on other sites More sharing options...
Arska134 Posted September 28, 2012 Author Share Posted September 28, 2012 Still not working that way. When i look painted wall closely i see this: 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. Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
franck22000 Posted September 28, 2012 Share Posted September 28, 2012 Hello, dont forget to add: clamp0=1,1,0 clamp1=1,1,0 in your material file Quote You guys are going to be the death of me. Josh Link to comment Share on other sites More sharing options...
Arska134 Posted September 28, 2012 Author Share Posted September 28, 2012 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. 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 Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Arska134 Posted October 4, 2012 Author Share Posted October 4, 2012 Still waiting answers. Nobody else doesn't have this issue? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted October 4, 2012 Share Posted October 4, 2012 Can you attach to the topic your material, textures and little lua-script representing that issue? So it will be much easier to investigate the case. Quote Link to comment Share on other sites More sharing options...
Arska134 Posted October 4, 2012 Author Share Posted October 4, 2012 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 Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted October 5, 2012 Share Posted October 5, 2012 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 5 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 5, 2012 Share Posted October 5, 2012 very nice daimour. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted October 6, 2012 Share Posted October 6, 2012 Excellent example daimour, your tutorials are really clear and well constructed. Quote 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++ Link to comment Share on other sites More sharing options...
Arska134 Posted October 7, 2012 Author Share Posted October 7, 2012 Thanks Daimour, but here is still problem. 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? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Daimour Posted October 7, 2012 Share Posted October 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
macklebee Posted October 7, 2012 Share Posted October 7, 2012 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 Quote 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 More sharing options...
Arska134 Posted October 7, 2012 Author Share Posted October 7, 2012 Looks like bulletholeMat variable was empty. After fixing, it now paints model faces blue. :/ Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
macklebee Posted October 7, 2012 Share Posted October 7, 2012 it works here... did you try the example I posted with the material and texture provided? Quote 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 More sharing options...
Arska134 Posted October 7, 2012 Author Share Posted October 7, 2012 I was writing message while you posted it. Now it's kind of working What are those black lines coming top of the hole? And how can i get those holes working on picked entity? Quote Windows 7 Ultimate | Intel Core i7 930 @ 2.80 ghz | Nvidia GeForce GTX 560 | Leadwerks 2.5 | Blitzmax Link to comment Share on other sites More sharing options...
Recommended Posts
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.