Unity Community |
I've changed it so it now only calls DrawLine3D Auto, and I went back to the .3 calls and changed them to '3' -- The result is actually much worse
Code:
function createLines() { Vector.DrawLine3DAuto(xLine); Vector.DrawLine3DAuto(yLine); Vector.DrawLine3DAuto(zLine); } { if (xLine) { //Vector.DrawLine3DAuto(xLine); //Vector.DrawLine3DAuto(yLine); //Vector.DrawLine3DAuto(zLine); } } }
Here's the result of that same code with null material instead of dash line:
![]()
Last edited by Charbl; 09-29-2011 at 02:23 PM.
Is that the scene view? It will only look right in the game view. Also, a dashed line will have the texture stretched out along the entire line, unless you use Vector.SetTextureScale.
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
That's the game view, unfortunately. What puzzles me the most is that the green line on the Y axis works fine, but the other two distort on camera movement and are way too large.
Here are two more shots -- I noticed that at a distance the lines eventually become and stay the right size.. here's the same scene, in Game view, from 2 different zoom levels:
Far away:
Close up:
![]()
Last edited by Charbl; 09-29-2011 at 06:26 PM.
Try making the lines shorter and see if that helps (or make them have more than one segment). If that's not it, do you have a multi-camera setup? In that case, it's a little trickier to setup so that the lines adjust to the correct camera. (i.e., you usually have to use SetCamera instead of it just working with Main Camera.)
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
Eric,
I looked in MakeSplineInLine() and messed around with a few cases. here's what I found. If you go to line 1661 and replace it with this:
Code:
var add = 0.995f / segments * numberOfPoints;
This causes it to not complete the full circuit from t=0.0 to t=1.0. However, what it shows is that the last 2 points are EXTREMELY close, but not overlapping as seen in these screen shots. Using this information, it seems pretty clear that there are 2 points that completely overlap. So, I tested a hack (shown below) that seems to fix the double point problem. I change the add 'value' and then clamp the number of points. It seems to work, but... it's hacky. Hopefully, you can use this to make a real fix.
Code:
(line 1661ish) var add = 1.0f / (segments+1.0f) * numberOfPoints; ... (line 1684ish) line.points2[pointCount++] = GetSplinePoint (splinePoints2[p0], splinePoints2[j], splinePoints2[p2], splinePoints2[p3], i); }
Attachment 24241Attachment 24242
Gigiwoo
Eric,
It's been a couple of weeks, and I was hoping that you had fixed this issue. I am now about 3 days away from my final build of the project - hoping to release it next week. It would rock if you would fix this one bug with MakeSplineInLine(). Hopefully, I've given you the exact location of the bug and even a way to fix it.
Would you please look at the suggested code fix above and make sure that it's the right way to do it?
Thank you kindly.
Gigiwoo.
Alion is Hiring Full-Time Technical Artist to Build Training Games!!
----
The Compliment Habit - (watch on Youtube)
The Gratitude Habit - 600+ reviews, 5-Star average
Good Sex, Great Marriage
The Secret of Success? - Fail; Improve; Repeat- 'till too good to ignore.
Well, as I explained, it needs to be that way, it's not a bug. It's actually for this exact reason that the source is provided, so that you can adapt the code as you need to in particular cases. I will of course fix all actual bugs.
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
I get it,today~![]()
My Blog:Http://Www.1Vr.Cn
Unity Tencent QQ Group:2453819,34643309,7838310,7838228
Unity Forum: http://www.iu3d.com
Development Environment:Unity Pro & iPhone Adv & MacBook Pro & iPhone & iPod & iPad & Zpad.
Hi Eric,
I hope this hasn't already been covered. This thread is huge (congrats!). We are building a very drawcall and performance sensitive game (iOS, for now). I could see us using Vectrosity for the simplest laser-like beam to drawing half the game, I just need to understand it a bit better.
1) Can I somehow use UVs from a 3D package like Maya so i can atlas lines with other objects to batch drawcalls? Everything would be done in 3D space and it would need to sit in the world (a beam would have to go behind some stuff and in front of others, and not just in a clean z depth layering scenario, but true 3D), so batching is the tricky part for us.
2) What do you think of the performance differences of drawing a grid which is static (my camera moves but the gird would never need to, is this possible?) versus a very low-resolution plane with a repeating square texture. Visual quality also has to be balanced of course. I think Vectrosity may create a sharper result without filtering, which I assume is a performance issue? I'm hoping you know because we are only just testing this part of for-iOS development.
Let me know if you would be willing to hop on skype (screen-sharing) for a quick consultation, if this sounds like something Vectrosity can do. We would buy it at the 'pro' price simply for the consultation if you are willing. We wouldn't ask you to solve our problems, just a quick demo of our current project and a short back-and-forth for ideas so we can avoid some trial-and-error. PM me if you would rather go 'offline' with this.
Cheers,
1) No, but I should point out that iOS isn't that sensitive to draw calls. It's only the first gen that needed to be so excessively careful with draw calls, but I assume you're not targeting first gen devices at this point.
2) Moving camera/static grid is certainly possible, and if you want the grid as an overlay, that's what happens automatically by default, since lines are normally (though not necessarily) drawn with a separate camera. If you want the grid behind everything else, it's almost the same, you'd just have to manually change the rendering depths and clear flags of the cameras. As for performance, using Vectrosity to draw a grid vs. using a texture on a plane would have much better fill-rate, as well as being sharper. Some devices (iPhone 4, iPod touch 4th gen, iPad 1) are sensitive to fill-rate, since the GPU is underpowered for the number of pixels on the screen.
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
1) Great information, thanks! I wish there were some guidelines. This is a Tower Defense game so it is easy to let drawcalls get out of control. I think I'm runing around 50 with a few hundred batched at the moment. I need to combine a few major atlases though (and i still don't know how particles fit in to all this). We would like this to run on 3Gs. I don't care about earlier devices.1) No, but I should point out that iOS isn't that sensitive to draw calls. It's only the first gen that needed to be so excessively careful with draw calls, but I assume you're not targeting first gen devices at this point.
2) Moving camera/static grid is certainly possible, and if you want the grid as an overlay, that's what happens automatically by default, since lines are normally (though not necessarily) drawn with a separate camera. If you want the grid behind everything else, it's almost the same, you'd just have to manually change the rendering depths and clear flags of the cameras. As for performance, using Vectrosity to draw a grid vs. using a texture on a plane would have much better fill-rate, as well as being sharper. Some devices (iPhone 4, iPod touch 4th gen, iPad 1) are sensitive to fill-rate, since the GPU is underpowered for the number of pixels on the screen.
--Eric
2) I'm thinking about using Vectrosity to draw our terrain (it is tron-retro-like with modern polish). I'm thinking I can output the simple geometry from Maya, put a simple shader on it for a "background" and use Vectrosity to draw the grid lines over it. I could let the first camera handle that and put my main camera above it.
Did I read that Vectrosity has functions built in to draw a "wireframe" of a mesh? If I have "background" geo in there it wouldn't even need to cull hidden edges, though i suppose that could cut down on poly count...?
Then what about the grid lines? Could I parse a mesh for the vertex points but not load it in to the game, and use the simple version with Vectrosity lines? I'm just brainstorming I could go with a simple grid if I have to, but I could get creative if I had an easy way to generate more complex grid-terrains.
Anything you can suggest or share would be helpful. I'll pick this up in the next few days as soon as I get past my current tasks. I'm looking forward to playing with it!
It has an editor utility for creating wireframes from meshes, and version 1.5 (not out yet) has a script function for automatically creating a wireframe from a mesh. Keep in mind that meshes in Unity are always triangulated; if you want quads, you need to use the utility and delete unwanted lines manually, or make some kind of custom function.
Yes, though as I mentioned meshes are always triangulated in Unity, so assuming you don't want that, you'd need to make your own function for data parsing, though for a grid that's probably not hard.Then what about the grid lines? Could I parse a mesh for the vertex points but not load it in to the game, and use the simple version with Vectrosity lines?
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
Thanks for the info. I look forward to taking it for a spin!
Hi,
I just want to use your project to draw a curve path and remove that path when an object moves on that path.
Could you please assist us to do that task with Vectrosicy. Is there any examples for this task?
Thank you very much.
Regards
Sajith J
The Path.js example script sounds like it's along those lines, if I understand you correctly?
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
Hi, I've used that example (path.js ) and could you please let me know that how can i implement a line removing function (In a game like flight control system/ harbour master like path drawing game).
I've already familiar with how to draw the path I just need to know how can I remove that path when an object moves towards that path.
Do I need to use discrete path ?
Is there any example for that ?
Thank you very much.
Regads,
Sajith J.
I've been using Vectrosity in my project for a while, and finally just updated the script (Its been a while obviously, since the latest rev is from July22!)
Now, i'm getting an error on first import:
Assets/Vectrosity/Scripts/Xray/XRayLineData.js(1,1: BCE0018: The name 'XrayLineData' does not denote a valid type ('not found').
Also a thought moving forward, since there isn't any real useful namespaces (as far as i know?), Path.js is probably not the best choices of Class name, as it then conflicts with any 'using System.IO; / Path.GetFile...whatever functions.
Currently removing parts of your package so as to not cluster-fsck my previously existing scripts.
That's not from the current version, so you can remove it.
That's just one of the demo scripts, and isn't something you'd be using elsewhere. Only the core Vectrosity scripts in Standard Assets should normally be used in other projects.
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser
Eric,
Is it possible to do 2D drawing? I'd like to hide the mouse cursor, at times, and draw a circle instead as the mouse cursor. At the same time, I'd like to be doing 3D draws in the game world.
Thanks!
Sure, Vector.DrawLine is 2D. Only if you use DrawLine3D will it be in the game world.
--Eric
FlyingText3D: dynamic 3D text with TTF fonts | Vectrosity: fast & easy line drawing | Fractscape: fast & fun terrains
Nifty utilities! Stitch terrains together - runtime model importing - file browser