Game Development Community

Possible for a scene object to render 3 planes instead of one?

by Steven Peterson · in Torque Game Engine · 06/06/2006 (11:38 am) · 5 replies

I'm still workingon some of the issues discussed at length in my Last Blog with getting the Jhan-Fractal Clouds working in my new resource.

The problem in short is I have a single scene-object that has to render three separate cloud-layers, rather than a single one like all my other working-examples.

I'm wondering if this is possible, or more importantly how it is accomplished? I think this is similar to what the old sky/cloud system was doing, but I've looked before and couldn't make heads'nor tails of it. Any suggestions/pointers would be greatly appreciated.

Thanks,
Steven

#1
06/07/2006 (5:06 pm)
Maybe I phrased the question poorly.

Using a simpler example:
Melv's fxRenderObject is a simple scene-object template that (by default) displays a simple *.bmp-textured 2-D plane in 3-D torque space.

How would one get the same single instance of an fxRenderObject to render three 2-D planes, each with a different texture, and slightly offset from each other?



If I can accomplish that, I'll be able to figure out my month-long sticking point once and for all! :-)

Any advice at all is greatly appreciated as I'm well beyond stuck!

Thanks,
Steven
#2
06/07/2006 (8:10 pm)
I know you've definately read through Melv's fxRenderObject tutorial notes. But I remember a certain note from the tutorial that I think may help if I brought to your attention:

Quote:
This brings me to an interesting point. You can insert more than one
SceneRenderImage into the SceneState during the call to "prepRenderImage"
which results in the "renderObject" being called more than once at the
point defined by the "SceneRenderImage"s attributes. I do this with the
fxSunLight but be sure you know what you are doing with this as you can
significantly reduce your framerate by causing the same objects to be
rendered multiple times.

And if you haven't already I would check out the fxSunLight code to see the prepRenderImage and the onRender code in action. The fxSunLight renders 2 seperate images both translucent, and the onRender code is called twice instead of once, but there's code there to make sure one image gets rendered and not the other.
I wouldn't imagine it being much harder to extend it to 3 seperate 2-D planes, just keep track of which is being rendered, and which is where and how you want to offset it :).

- Eric

P.S. If you tried this method, you might want to give a brief list of what you've tried and what didn't work
#3
06/07/2006 (9:11 pm)
Eric,

Thanks! I did read this about a month back, but didn't really understand that portion at the time. Aside from refreshing my memory, your supplemental-explanation helps to clarify Melv's comments a little I think. I'll give this a shot and post back with results.


--


I addressed your PS. (before you posted it) in a humorous message that got eaten by the internet - so for the record:

Larger Problem Statment
To implement the Jahn-Fractal-Clouds ( a composit effect of 3-Cloud Layers ) as a single "Cloud-layer-object" in a new cloud-system where each cloud-layer is an independent sceneObject, and different types of Cloud-Layer objects can co-exist (accomplished throuh inheritence) .


Failures To Date
This is the first attempt at the 4th unique approach to solving my "Larger Problem". Previous Solutions include:

- Use Additive Blending - ( wrong effect )
- Create "sub-layers" for each Cloud-Layer - ( 2x code bloat, not really feasible )
- Use Alpha-Blending per Frame - ( 3 x 256x256 bitmaps; big processor hit )
#4
06/07/2006 (10:30 pm)
Alright, if you need any clarification help with the prepRenderImage / inserting more than one image in, and the onRender / rendering layers stuff - just post back here.

Also I heard you had problems with networking and such (from your .plan), if you still need some help - give me a shout and I'll be happy to help with the networking code.
I look forward to seeing this as a resource :)

- Eric
#5
06/08/2006 (7:59 am)
Eric,

Thanks for the help man. I'll let you know here, if i have more questions with the renderObject issue. After that the next thing on the list should be networking and I will deffinitly need help with that, so I'll be in touch. I can't wait to see this as a resource too! :-)

Thanks again!