GarageGames / Torque3D Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ribbon implementation #744
Ribbon implementation #744
Conversation
This is a prerequisite change for the Ribbon implementation.
|
I love you. But, it looks like the build failed with this error: |
|
Huh, I compiled and ran it before PR'ing.. I'll have a look at it. |
|
The build failed on Ubuntu, but I suspect that's just because that was the build that ran first. If you really can't reproduce it, maybe try compiling a dedicated server. |
|
Btw don't know if you noticed it but it seems to compile now. |
|
Yup! Just have other things to do for 3.6 :/ |
|
Ideally we'd like some documentation on this for it to be accepted: specifically, docs on each field in |
|
Sure thing I'll brew something up. |
|
I ask because I'd like to get this in 3.6 as eye candy. It should be easy for us to review since it doesn't touch much existing stuff, just adds features. |
|
I'll write doxygen documentaion for the Ribbon class, and I'll put up datablocks for ribbons with and without textures. Just give me a few days :) |
|
Sweet, thanks! |
This class is based on Tim Newell from MaxGaming Technologies code, it's a Ribbon class which is easy to use from other classes.
Simple RibbonNode class for an implementation similar to that of ParticleEmitterNodes. Datablock currently has no static fields.
|
Reviewed and it looks pretty good. Questions, though:
I'll make a PR to your repo with these changes, so they can be added to this PR without me having to open a new one. |
| if(!mActive || mRibbon.isNull() || !mDataBlock) | ||
| return; | ||
|
|
||
| MatrixF trans(getTransform()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not getRenderTransform? Then the next line would have to use getRenderPosition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just implemented it as it is in ParticleEmitterNodes:
Torque3D/Engine/source/T3D/fx/particleEmitterNode.cpp
Lines 289 to 290 in 69838bd
| getTransform().mulV(emitAxis); | |
| getTransform().getColumn(3, &emitPoint); |
Would need to change both in that case imo, though it doesn't really matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. I'm just thinking, for example, a ribbon attached to a node on an animating shape. We'd want it to use the render position to account for that animation, surely. It's probably even more important here than in particle emitter because the interpolation between ribbon segments is actually visible, whereas with particle emitter nodes is generally isn't.
|
Oh, now I see that some of those Empty additions are because of shaders that need to exist. Le sigh. Oh... and they're... specific to the new art? Is there any sort of generic ribbon shader that could be added? What's the minimum amount of script needed for ribbons to work? Please don't tell me I have to write a new shader for every type of ribbon I want? |
|
What do you mean with interpolation? The minimal amount of script would be all the "basic" ribbon stuff. It's the simplest ribbon there is (just a simple colored ribbon). You have to write a shader for specific ribbons yes. But it's no big deal.. E.g. the basic ribbon shader renders a single color, but you can choose the color in the ribbon datablock. I just thought that a simple uniformly colored ribbon and a textured ribbon would be the most common use-cases, so I decided to add both. |
|
Random note: CustomMaterial rendering doesn't play nicely with others. Eg, does not get fogged, does not receive shadows, etc. Ideally this would use a regular Material to render, then you get all normal material features as well as playing nicely with others. |
|
I realised that when I was asking about interpolation it was because I was playing around with ribbons in the editor like in your video, and the basic ribbon has some obvious kinks in the path - but I realised that's because the editor is just calling setTransform a bunch, rather than doing any interpolated motion, so the ribbon itself doesn't get a chance to interpolate and create segments in those intermediate positions. I'm not the happiest that defining ribbons from scratch requires defining shaders, but ah well. So do lots of things in the engine. If that's the best solution then I'll have to swallow it. It sounds like it also allows ribbons to be more flexible. Thanks for the heads-up @jamesford42. Why is CustomMaterial necessary in this case, and what would it take to get ribbons to use regular Materials? |
|
The vertex shader and pixel shader are not actually doing anything custom at all. You can probably just swap in a regular material and it might work. Alternately if there is some setup work for materials I am forgetting about, DecalRoad would be a good reference class since it has transparency but uses regular materials (if i remember correctly). |
|
I updated with editor integration and simplified scripts. Also removed some of the datablocks from the Empty template, such that Empty only has the simplest available Ribbon. I couldn't make regular materials work, maybe someone else can step in on that one? |
|
The new Empty scripts look good, but all those singleton names (datablocks, materials) should have capitalised first letters :P. I sent you a PR (lukaspj#1) with some code style changes to make the source look a bit more like the rest of Torque with more spacing and alignment, and removed the |
Improved code style in ribbon files
|
Whoops. I went to change the capitalisation of the names but then you merged. I also meant to change |
|
Ah I thought for some reason that you wanted to do it in a different PR... Sincerely -----Oprindelig meddelelse----- Whoops. I went to change the capitalisation of the names but then you merged. |
|
I'll make a new one. lukaspj#2 |
Renamed default ribbon datablocks
Fixed a shader related crash and textured ribbon's material
|
For now, we will merge this using |
This PR adds an implementation of Tim Newell's ribbon code, with a "ParticleEmitterNode-like" RibbonNode.
Since receiveing the code from Tim, the following changes has been made:
This video shows off most of the new "front-end" features.