Game Development Community

T3D Dynamic Textures?

by Demolishun · in Torque 3D Professional · 01/04/2013 (9:11 pm) · 13 replies

I have been searching the forums for this, but cannot find anything that uses the current T3D material system. I looked through the code and don't see anything definitive. Are there any simple examples of this?

Here is what I found from 2002:
www.garagegames.com/community/forums/viewthread/3973

Edit:
Oh, and I want to be able to modify the texture on a model in the sim.

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67


#1
01/05/2013 (12:54 am)
The webkit integration renders dynamically onto in game objects, I think that's achieved by first rendering the web page to a texture which can then be mapped onto objects. Might be worth digging through that code.
#2
01/05/2013 (5:20 am)
Yeah, I think that might be what I need. I looked through the code by Josh Engebretson and it covers what I was missing. I also looked at the docs for how materials get assigned textures. It does not mention textures that use the pound sign at the beginning. I believe this means it is in the resource manager? When I get this figured out I will provide a simple example.
#3
01/05/2013 (6:48 am)
Frank, the pound sign might be a marker used by the asset system to indicate the current default resource path, or it might be something else. In the new asset system for T2D this is used basically to say "this texture file has the same path as the material.cs file it is found in". Might be similar or it might just be coincidence. Have to ask Melv to be sure.
#4
01/05/2013 (6:49 am)
Sup Frank,
I was actually working on implementing the old Dynamic Texture resource from TGEA(and the updated version for T3D 1.1) in my build, which allows for interactive gui's on the models. I got sidetracked by higher priority stuff for the meantime, but I got it rendering the gui to the material(though for some reason, it flipped horizontally, didn't get a chance to figure that out yet).
This may or may not be what you're looking for.
#5
01/05/2013 (8:57 am)
@Richard,
This is how the GuiWebCtrl is using the pound sign:
singleton GuiWebCtrl(MyWebTexture) {
    renderMode = "texture";
    targetName = "MyWebTexture";
    texSize = "512";
    url = "file:///example.html";
    position = "0 0";
    extent = "512 512";
    profile = "GuiTextEditProfile";
    visible = "1";
    disableScrollBars = "1"; // don't want any scrolls for web content
    fps = "33"; // streaming video, let's push it :)
};

singleton GuiWebCtrl(MyWebTexture2) {
    renderMode = "texture";
    targetName = "MyWebTexture2";
    texSize = "1024";
    url = "http://www.torquepowered.com/products/torque-3d";
    position = "0 0";
    extent = "1024 1024";
    profile = "GuiTextEditProfile";
    visible = "1";  
};


singleton Material(WebCube_WebCube)
{
	mapTo = "WebCube";
	diffuseMap[0] = "#MyWebTexture2";
};

singleton Material(WebCube2_WebCube2)
{
	mapTo = "WebCube2";
	diffuseMap[0] = "#MyWebTexture";
};

@Jeff,
Yeah, if it is available somewhere I could definitely look it over. I am thinking I will base mine on a SceneObject like renderObjectExample.h as I really only need the "render" function call. However, the examples I am seeing are GUIControl based. The reason I thinking about using the SceneObject is to make it so you can add it to the scene in the mission. It would be an invisible object and would provide a texture for materials. Not sure if this is the best way to do this or not.
#6
01/05/2013 (5:16 pm)
Yeah, looks like it's a path expander - I think the engine will expect the texture to be in the same folder as the script this declaration is in. This is virtually identical to the way the new T2D asset system uses that notation. You could probably replace # with ./ and it should still work (if you wanted to check).
#7
01/06/2013 (2:32 pm)
The WebCube example does not have textures for this at all. I think what is happening is the GuiWebCtrl is creating that resource in the resource manager first, then the Materials use whatever texture appears in the logical path. Even though the texture does not exist on a file. As long as the GuiWebCtrl singleton is defined in the same file/directory I think it would work fine. Part of what I was struggling with is how to I relate a texture to a material on an object. This shows me that this stuff is already exposed to script. I don't even have to talk to any objects that use the texture directly.

Thanks for the explanation of that pound sign. It makes a lot of sense now.
#8
01/07/2013 (11:40 am)
I'm pretty sure I remember reading about the # and $ prefixes for textures. It was by Tom Spillman I think. I got the impression that the # let you reference textures created dynamically or something along those lines. I did a quick search, but can't find the post any more :(
#9
01/07/2013 (11:47 am)
Actually, this is the post (by me, doh!) where Tom mentions the # prefix
www.garagegames.com/community/forums/viewthread/112927
#10
01/07/2013 (11:51 am)
Ah - a case where T2D and T3D are wildly different! There you have it....
#11
01/07/2013 (1:39 pm)
Quote:a case where T2D and T3D are wildly different!
Maybe T2D should use "./" instead of the # prefix? This is probably going to confuse someone in the future.
#12
01/07/2013 (3:13 pm)
It's used in the asset files (replacement for datablocks) and would rarely (if ever) be seen by anyone not attempting an overhaul of the asset system. Famous last words and all, but it shouldn't be a problem....
#13
01/07/2013 (3:25 pm)
Thanks for covering your asset system in detail. :)