Render To Texture

Hi!
i just made Render To Texture prototype using Mike Pan’s real-time image capturing script and alien-xmp’s real-time image reloding script. Im wondering why anyone haven’t thought of this before :confused:. Just imagine what you could do with render-to-texture feature - real-time reflections, refractions, light bloom, motion blur, video surveillance cams and tv screens displaying video in realtime, etc…

screenshot:
http://img100.imageshack.us/img100/9342/rttzm7.jpg

and blend (0.05MB): http://www.savefile.com/files/799717
newest version - http://www.savefile.com/files/804114

before you press P you must specify the directory where image is saved (in saveFrame.py)

i can’t do scripting …maybe someone who knows python could make a new script with features as :
1.rendering from specified camera (not viewport)
2.specifying rendered image size, for example - 640,480…
3.disabling that Save over

realtime refraction - bumped sphere
http://img514.imageshack.us/img514/1913/28kl1.jpg
movie :
http://www.savefile.com/files/799797

very very cool!!! definately something for Apricot to look at!!!

Video Texture plug-in contains class TexImage, that allows loading texture from file in realtime. I also did tests with realtime texture capturing, that allowed to use rendered frame as texture (I didn’t release it in plug-in, because I see a little usage of this feature).
Real render to texture usable for realtime reflections (and other simillar purposes) requires to render one or more frames to textures from different cameras before rendering of main frame for display. This is not doable in GameBlender without some modifications of realtime renderer (I did some research in this direction). Currently it has small priority, because I’m trying to get video texture plug-in to work on linux.

doesnt work for me :frowning:
(and ashid im sure many people would have found that useful :slight_smile:

thanks ashid for info

_LsBlend,
give me some examples, where can be rendered image used as texture. Maybe some abstract realtime animations, animations for VJ-ing… But I cannot see much use of it for games.

But no problem, if there will be such requirement, I can easily add it to video texture plug-in.

Another idea - instead of using GB renderer, there can be used different renderer available in Python (f.e. rendering in OpenGL) and result of this render can be loaded as texture in video texture plug-in.

for games?
well ive seen many “stadium” themed racing games where you pass a videobillboard that shows the current screen :wink:

This is real?

Render-to-texture in Blender?

Hurrah!!!

well it works… only it renders from main viewport, not from a specified camera… and it needs a bit tweaking - at least to get rid of “Save over” thing, and to specify screenshot size.

mmm … it’s a long time I hope this could be real … I already had this idea and ask the question on one thread last year … but the solution of “saving a file reloading it” from the hard disk is realy slow and dirty …
I would be happy this could be implemented in the video-plugin, after the port for linux …
I would use this as an abstract effect generator for … abstract video art and/or VJing … but also for “not-so-abstract” scenery as special effect generator… in fact this could be used as a 2 pass effect in combination with GLSL on a plane in front of 2nd camview, it can lead to Bloom, refraction, mirors, focus, etc …
the best for all these of course would be Ogre integration, but I think for limited/specialised usage, it can be interresting …
maybe we could add this on the bounty list ?

https://blenderge.bountysource.com/

Cool. .

hey martinsh.
try this to remove the overwrite prompt:

# change this to the directory you want to save frames into
# MAKE SURE IT EXISTS!
directory = "RTT/"
# the \\ is how you need to write back slashes (for windows)
# don't forget the slash at the end

import os
import Rasterizer
obj = GameLogic.getCurrentController().getOwner()
# obj is the object this script is connected to

filename = "%04d.tga" % obj.frame
# change anim to something that suits you, leave in the %4d.tga

os.remove(directory + filename)
Rasterizer.makeScreenshot(directory + filename)
#print "wrote screenshot"

obj.frame = 0

Good solution. Simple, elegant…(I guess you know Ed from the Incredibles)

Wicked o_O

Pseudonym, u rock, thanks a lot. it works good.
ill make a demo asap

I gave it a try this evening and made a test for OpenGL rendering to texture using different renderer (as I suggested yesterday).
pyOpenGL module was used to render black triangle.
PIL module was used to store rendered image.
blendVideoTex plug-in (class TexImage) was used to load image to texture.
http://ashsid.szm.sk/images/testGL.jpg
This solution is in very early stage, but it doesn’t need saving rendered image to file and later it will be possible to skip image handling through PIL, too.
I can imagine that in future texture renderer will be able to load models’ data using GameBlender API, then render them from specified point of view and automatically load rendered image to texture.

It would be usable for simpler scenes (due limitations of GameBlender API it won’t be able to handle skeletal animations and GLSL shaders may be problem too).

hmmm… I can’t get it to work… having problens with the directory path
didn’t understand the stuff about \ and the slash at the end ( I’m using windows)

what whould I have to put in the script for c: emp directory?

cheers

ya i tried it on windows, and got it to work

example: directory = “C:\Documents and Settings\User\yourdirectory\”
then press p
and an image named 0000.tga will be created in this dir
then apply this image to plane
and press p again

here is new version - http://www.savefile.com/files/804114
that should work

and a movie of refracted shotgun in Social’s FPS template here - http://www.youtube.com/watch?v=Roi8I-GP_kM

Hi there
I put this in - directory = “C: mp\” and it does exist but I get this in the python consol

ERROR: Image not available. Keeping packed image
ERROR: Image not available. Keeping packed image
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “saveFrame.py”, line 16, in <module>
WindowsError: [Error 22] The filename, directory name, or volume label syntax is
incorrect: ‘C: mp\0000.tga’
ERROR: Image not available. Keeping packed image
ERROR: Image not available. Keeping packed image
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “saveFrame.py”, line 16, in <module>
WindowsError: [Error 22] The filename, directory name, or volume label syntax is
incorrect: ‘C: mp\0000.tga’
ERROR: Image not available. Keeping packed image
ERROR: Image not available. Keeping packed image
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “saveFrame.py”, line 16, in <module>
WindowsError: [Error 22] The filename, directory name, or volume label syntax is
incorrect: ‘C: mp\0000.tga’

I’m probably doing something stupi - off to bed zzzzzzzzzz