Skip to main content
GameDev.net gamedev.net
🔒 Locked

Updating texture

Started by b3rs3rk Feb 15, 2007 at 7:55 AM 5 replies 650+ views
Original Post
b3rs3rk
b3rs3rk
what's the best/fastest way to update a texture? Ok I think I need to be more precise :D I've a texture 1024x1024 (the format it's not important. assume it's rgb16 or simply r16f, it doesn't matter) that contains some data i need to read in a pixel shader. About every frame (actually it's about every ten frames) I need to update an L-shaped portion on the border of the texture (size and offset are already known), something like this: like this Basically I need to "shift" the image on the other side, freeing space for other data. The question now is: do i need to clear the texture and recreate it or there's a simpler way?
Schrompf
Schrompf
Sounds to me as if you should do the offsetting by manipulating the texture coordinates. Shifting the gfx inside the texture will always turn out to be a complete reload of the texture, at least to my knowledge.

If you do some terrain, you better split your geometry at regular intervals and assign portions of the texture to each of the segments. This way you can update and reuse isolated portions of the texture without moving the other portions. If you're out for clouds and such, just repeat the texture or sample it at several magnitudes, that's enough for good-looking perlin noise.

Just guessing from the texture. If you have something alltogether different in mind, describe it. To me it seems better we find a different solution to your problem, shifting gfx in a texture will be ineffective.

Bye, Thomas
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
Icesaber
Icesaber
I don't know the specifics of where the new data comes from, but consider looking into Render Targets. I don't have any links, but a Google search should find some info.

Icesaber
JasonBlochowiak
JasonBlochowiak
I would probably use two textures and render back and forth between them when I needed to shift the data.
b3rs3rk
b3rs3rk
Quote:
Original post by JasonBlochowiak
I would probably use two textures and render back and forth between them when I needed to shift the data.

that would be very time consuming.. I don't think I can do that quite every frame :/

@Schrompf: yes, I'm doing terrains.. an approach like Hoppe's Geomipmapping, so I cannot split the texture in several parts, I have to update it all -___-'
Krohm
Krohm
Quote:
Original post by b3rs3rk
@Schrompf: yes, I'm doing terrains.. an approach like Hoppe's Geomipmapping, so I cannot split the texture in several parts, I have to update it all -___-'

What a coincidence... Geomipmapping is another thing BTW.
Why cannot you shift texCoords? Then, the "released" zone could be computed (it would "move" inside the texture space) and filled. Ok, you really don't shift the texCoords obviously, you would modify them in the VS...

Previously "Krohm"
Sc4Freak
Sc4Freak
Shift the texture coordinate in the VS, and when setting the adressing mode in the pixel shader, set it to border.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.