Author Topic: render targets bug (they know about it but its not in mantis)  (Read 5142 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
render targets bug (they know about it but its not in mantis)
ok i found wmc's demo code for rtt through scripting and went through it to make it function under recent builds.

Code: [Select]
;;render targets

#Global Hooks
$SIMULATION:
[


--Check for target_set variable, we only need to do this once
if not target_set then
--Create a texture to draw on
--'tex' will always be nil under OpenGL
tex = gr.createTexture(256, 256, TEXTURE_DYNAMIC)

--If tex was successful, then go ahead with the drawing
if tex:isValid() then
--Set that texture as the current drawing/rendering buffer
gr.CurrentRenderTarget = tex

--Set current color to grey
gr.setColor(64, 64, 64)
--Draw rectangle on entire texture
gr.drawRectangle(0, 0, 255, 255, true)
--Set color to green
gr.setColor(0, 255, 0)
--Write "Hello, world!"
gr.drawString("Hello, world!", 0, 0)

--Switch back to drawing on the screen
gr.CurrentRenderTarget = nil

--Switch to ship to change textures for
ship = mn.Ships["Alpha 1"]

if ship:isValid() then
--Assuming this is a Ulysses, set all textures to our new one
ship.Textures['fighter01-01a'] = tex
ship.Textures['fighter01-01b'] = tex
ship.Textures['fighter01-01c'] = tex
end
end

--Set the variable so we don't re-do this every frame
target_set = true
end

]
#end

you will note that it doesnt work. now i know that rtt is working in thje engine under ogl, because thats how env mapping works. but the scripting interface to rtt is broke, or im not using it right. i looked on mantis to see what knd of progress was made on it, but noone reported it. so i figured id post a report bercause this is a feature i need for something im working on.

anyway i just wanted a solid example of the problem i could post with the report. sence ive never actually been able to get ttis to work, i need to make sure my adaptation of the script is supposed to work. i need some other scripters and maybe wmc to go over this and make sure its correct.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
Last I heard, it was actually a bug with non-cubemap textures used with RTT.

But what's happening there is a combined RTT and texture replacement operation. I couldn't tell if RTT is working or not (though if the textures disappear, it's probably RTT, and if there's no change, it's probably texture replacement).
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
the only time i see something other than normal operation is when i comment out the line

Code: [Select]
gr.CurrentRenderTarget = nil
the old way in the example just had us use setRenderTargets() with no arguments to set to the default target. i assumed setting it to nil was required to restore default targets. if its in nothing happens, engine runs as normal. nothing different renders, and no hello world on the ulysses. if the line is commented out, rendering from the commit onword stops working (im assuming the render target effects all game rendering, which should cause all game rendetion to be sent to tex rather than the screen) this of course locks up the game.

or perhaps its just something to do with doing this
Code: [Select]
ship.Textures['fighter01-01a'] = tex
in which case tex is there, but its not being set to the model before being rendered.

ive also tried the code in both simulation and hud hooks. and each produces the same effect.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
That sounds like a texture replacement bug. Try using RTT and then using gr.drawImage to draw the image directly to the screen.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
ok, i wrote this to help debug wether or not texture replacement is working

Code: [Select]
#Global Hooks
$GameInit:
[
tex = gr.loadTexture("asteroid01a")
]
$Simulation:
[
if tex:isValid() then
ship = mn.Ships["Alpha 1"]

if ship:isValid() then
ship.Textures[1] = tex --put an index or a "texture name" in []
end
end
]
#end

well i removed all the rtt stuff and just used loadTexture, and i was able to replace ship textures with it using
Code: [Select]
ship.Textures["texname"] = tex
texture replacement sometimes works. i was able to swap one of my fighter's textures though i cant seem to get it to work on a ulysses. when i tried the uly i couldnt change the main ship texture. i was able to get to the thruster ani by using
Code: [Select]
ship.Textures[2] = tex
this is odd because the thruster ani is the first texture on the texture list for that ship, and not the second. i think it might have something to do with the thruster ani, or the fact that the ulysses has 2 copies of "Fighter01-01a" in the list. changing the number usually has no effect, and not does setting it by string.

with my ship (which was the apis, which had one texture of the same name) everything worked as it should i was able to change its texture with either of theese

Code: [Select]
ship.Textures[1] = tex
ship.Textures["apis"] = tex

as for rtt, i tried drawing the texture to the hud, but it was black. i8 was also able to get that black texture to render to a ship once. dispite the target being set to a texture, nothing was drawn.

just to make sure i understand the way things have been redone in recent builds. how do i reset the render target to default. i used
Code: [Select]
gr.CurrentRenderTarget = nil is this correct?

*edit*
i did some more testing, my conclusions are that texture replacement will work properly so long as ther are no animated textures used. if there are indexes get scrambeled and may not work at all.
« Last Edit: August 11, 2007, 07:45:48 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
gr.CurrentRenderTarget = nil should work.


Strange. I haven't committed that variable to CVS. In fact, there are a crapload of files in my local codebase that haven't been committed.

:sigh:

I found my missing subsystem name override feature.
-C

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
Nuke, if I sent you diffs of my codebase changes, would you be able to implement them in CVS? There's no way I'm going to have the time to work on getting them committed for the next week, and I recognize the changes that weren't committed as being a buttload of changes that were requested by various people, or that I thought were important in some fashion.

Also, I'm pretty sure my codebase is three months out of date, and repeat bugtesting time would just compound the problem, although all these changes are for the unstable branch anyway.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
im not sure. but i could give it a try. ive been able to set things up to compile before. so its possible i could make builds to test with. id also need a compiler that works under vista, ive had some problems running vc++6.

*edit*
after some looking around i found kara's post on how to configure cvs. im downloading head now (or should i use the stable branch?). my compiler should work unless i try to do something stupid. it locked up a couple times when i was working on my game engine, but that was during a compile and after a save. im gonna go figure our what other thinks i need to install to get a build going. hopefully by the time you send the updates il have it ready to go.

*edit again*
i got a working (or rather working until i hit commit :D) up-to-date head build, that is assuming i used cvs right :D
« Last Edit: August 12, 2007, 10:10:01 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: render targets bug (they know about it but its not in mantis)
Could you upload that head branch build somewhere? New HEAD branch builds have been extremely rare
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
i would if it worked. even with vanilla data, it locks up on mission commit.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: render targets bug (they know about it but its not in mantis)
Yeah.. i read that.. but i hoped it was only the scripts/RTT... darn. AFAIK there havent been any publicly released head branch build since WMC's C05202007 build.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
upon further testing, i have found that the build i made works just fine, it was my pilot file that was bad :D

il upload to gw and post it in builds of intrest

*edit*

playing around with the build it seems all the scripting stuff took a step backwards. things like Shields.CombinedMax and Subsystem.Name are either missing or have reverted to their function counterparts. i could try compiling in those diffs.
« Last Edit: August 13, 2007, 01:32:19 pm by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
Here's the patch file. Be warned that the ship_subsys_get_name() is part of my alt-subsystem name stuff, and it does change the subsystem name in the log files. (This, according to another discussion on the forums, breaks SEXPs)

The bitmaps go in fs2_open\code\fred2\res . They're used for the numbered data item icon feature in FRED2.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
ok, il got to work on it now.

i only really need to read the subsystem names for some things. i havent really found a need to change the name from script. so i shouldnt have a problem with that.

*edit* how exactly do i use theese patch files?
« Last Edit: August 14, 2007, 12:07:13 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
I did a google search and found this website, which looks reasonable.

I've only applied patches once, and that was way, way back. I'd have to look things up and do testing to figure that out, and I can guarantee that I'm not going to have time for the next week (probably more).
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
well that almost worked, i had to re-dl everything from cvs because after running the patch util, vc++ wouldnt start. the funny thing is it still wont start. a reboot would probibly fix it. i think i need a compiler a little more vista friendly.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
You might want to try removing the project files from the patch, then.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
this patch util is rather odd as far as command line utils go. it doesnt quite follow the usual rules that most windows command line utils use. you cant just type patch dir file options. you have to punch in something that looks like a line of code or at least the linux command line. i followed the instructions the site you posted gave. i think the problem is its trying to apply the diff to the directory i run it in only. im trying to figure out how to make it go recursive and actually see the all the files its supposed to be patching. i might just have to go dir by dir until everything is patched. and that could get messy.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: render targets bug (they know about it but its not in mantis)
How is this going?
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: render targets bug (they know about it but its not in mantis)
not well, i havent tried to get it to work for abit. been busy with work and a bunch of other stuff. i think im gonna have to run the patch utility in each folder of the codebase, one at a time. or find a different utility. i got today and tomorrow off so i might poke around and see if i can figure this thing out.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN