Render to texture?

Blitz3D Forums/Blitz3D Programming/Render to texture?

mrtricks(Posted 2004) [#1]
I think there was some talk about this previously but I can't find it.

Is it possible to set up a camera in Blitz to render directly to a texturebuffer? It would be SO beneficial. If not, maybe this could be added onto the massive wish list for future Blitz releases? Or is it impossible in DirectX?


jfk EO-11110(Posted 2004) [#2]
It has been discussed many times. As far as I remember Mark said it isn't impossible, but it would reduce the compatibility to a serious number of cards massively.

We still got Flag 256 for textures, so you can transfer the backbuffer to a texturebuffer after rendering. might be a bit slower, and the 256-flag isn't compatible with all cards, but it's still pretty useful.


Mustang(Posted 2004) [#3]
Render to texture is pretty basic DX stuff - with new cards, say made within two years, but Kyro for example has problems with that although it's a "new" card. To be able to do any cool post processing effects you really need render to textures... just check what difference it makes by running for example 3DMark03 gametests (no post processing) and demo (with post processing, like bloom and coloring effects).


John Pickford(Posted 2004) [#4]
This comes up a lot. To me it's a major ommission.

Currently you have to render to the backbuffer and then do a copyrect to the texture buffer. Cumbersome and slow.

Another problem is you are limited by the size of the backbuffer. In sticky balls I wanted to do a shadow texture of 512x512 but this didn't work if the user set the game to run at 640x480.

I think it would be better if blitz had a proper render to texture feature; Even if on some (most)cards it does it the slow way (behind the scenes).


Beaker(Posted 2004) [#5]
Agreed. It could be a configurable option the same way that cubemapping and hwmultitex are.


Skitchy(Posted 2004) [#6]
Some people are bound to say "DX can't do it". Don't believe them - it can. There are *many* engines that use it. It *might* not be in DX7 though.


Mustang(Posted 2004) [#7]
It *might* not be in DX7 though


http://developer.nvidia.com/object/DX7_render_texture.html

Nice reading:

"Rendering to Texture Surfaces Using DirectX 7"

http://www.gamasutra.com/features/19991112/pallister_pfv.htm

Wrapping It Up

Being able to render to textures adds one more valuable tool to the developer's arsenal, offering many exciting possibilities for 3D applications and extending the range of available effects to new limits. Now that this capability is supported by a substantial installed hardware base, and the DirectX7 API exposes the feature, developers can start actively using it in their applications. We hope the techniques presented in this article will guide developers along the path to taking advantage of this approach to rendering.

By Kim Pallister
Gamasutra
November 12, 1999



Since it's now 2004, I think that we can safely say that it would not be too "exotic" or "new" feature to add to Blitz3D... :)


John Pickford(Posted 2004) [#8]
We are currently using Method C (according to the gamasutra article posted above).

It would be cool if blitz automatically (silently) used methods A,B or C depending on hardware.

A compromise would be to allow us to check for the hardware capability and code our own A,B &C methods.


Tom(Posted 2004) [#9]
Bump!

Speaking of the vram flag, I'm getting massive slowdowns in my shadow render loop (4ms upto 40ms!) if I have the vram flag enabled for the texture I'm rendering to, anyone experienced this?

Specs in sig

Cheers
Tom


Shambler(Posted 2004) [#10]
If I enable vram I lose mipmapping so resulting in a major slowdown.


Ken Lynch(Posted 2004) [#11]
Rendering straight to a texture is definitely needed.


Gabriel(Posted 2004) [#12]
It would have been useful before, but since we now have cubemaps and can't use them for realtime effects without taking a big speed hit, they're now practically essential.


TeraBit(Posted 2004) [#13]
Yes I really missed that when doing Tattoo. Thumbs up for Render to texture (and Z-Buffer access).