TrashCaster Posted September 10, 2015 Posted September 10, 2015 Like the title says. Is there any way for me to bake a GL texture into a base texture? I am doing this because my mod adds canvases, easel, and palletes to allow user made paintings. It renders the paintings onto the canvas model in the easel just fine, as it does when put in an item frame (through the use of an render item frame event). If I can make my texture use a base texture, and overlay the GL texture onto it, I can have the item show the painting in all places, and possibly remove the need to hijack the item frame's render event (which may reduce lag, though none is noticed right now). I did a small bit of reading, and example scavenging, and I know TheGreyGhost has the MBE tutorials, but I'm not seeing how that could apply to my case. I assume I will need to use an ISmartItemModel, but as far as that goes, I don't know. Never really delved into that. I saw one post with a similar need to mine, and TheGreyGhost mentioned stitching the GL texture into the TextureAtlas. So if that's something I could get a bit of help on, that'd be really cool. Edit: I have added my mod's GitHub repo so people can download this and monkey with it, since I personally haven't been able to get it to work. Quote
Abastro Posted September 10, 2015 Posted September 10, 2015 I think you would really be unable to do that with normal item.. Current system only allow stitched textures to be rendered. You might use something like TileEntityItemstackRenderer. Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
TrashCaster Posted September 11, 2015 Author Posted September 11, 2015 So I've tried both Post and Pre, and neither seem to work. It's making my item model into the pink and black cube. My code is: @SubscribeEvent @SideOnly(Side.CLIENT) public void onTextureStitch(TextureStitchEvent.Pre event) { event.map.setTextureEntry("tsm/paint", new TextureCanvas("tsm/paint")); } My item JSON model is: { "parent": "tsm/paint", "textures": { "layer0": "tsm:items/canvas" }, "display": { "thirdperson": { "rotation": [ 0, 90, -35 ], "translation": [ 0, 1.25, -3.5 ], "scale": [ 0.85, 0.85, 0.85 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } I made this all based on how I see the compass and clock register . They use the resource location's string as their icon name, which happens to check for builtin/compass and builtin/clock. The models for them use those exact strings for their parent tag. I basically have a direct copy of it, changed to my own string and class. So the problem can be either, I'm registering the new class wrong, my update method in the class is wrong, or this just doesn't work for some other unexplainable reason. I don't like asking to be spoon fed code, but I'm beginning to feel like I need to see some code to get mine to work. Anybody feel like rigging something up? Quote
TrashCaster Posted September 11, 2015 Author Posted September 11, 2015 I tried that too. Still, no dice. And the compass JSON uses builtin/compass and then applies texture layer0 to the compass PNG. So I did exactly that. And the other thing is, the updateAnimation method is never being called in my new class. It is overriden properly, and it's getting instantiated. But it is never called. I confirmed this by adding a System out line, and I get no feedback. Quote
TrashCaster Posted September 11, 2015 Author Posted September 11, 2015 Still nothing. Could I upload a zipped src for you to look through, so you could see if I did anything wrong? Quote
TrashCaster Posted September 13, 2015 Author Posted September 13, 2015 updateAnimation will only be called if hasAnimationMetadata returns true, meaning you need an (empty) .mcmeta file for your texture, like the compass does as well. I have uploaded the source to Uppit. Here it is if you want to toy with it. Cause at this point, I don't know what I'm doing to get it working. I've tried all suggestions, and all alternatives, and I'm close to giving up doing it that way. I really want the item model to have the texture though. Worst case scenario, I could re-generate the item with ISmartItemModel and set the face colors per pixel, right? Quote
TrashCaster Posted September 14, 2015 Author Posted September 14, 2015 I don't know how to do that. What if I use paste bin? Quote
TrashCaster Posted September 14, 2015 Author Posted September 14, 2015 I looked up some how-to about GitHub, and now have my source hosted there. Thanks for the tip guys. I've only done my first commit to get it online, and it's not well documented. I'll fix that in the second commit. I've added it to the main post. So as I said, any help on how to do this would be magnificent. Please try not to spoon feed me code, unless it's something I can learn from. I don't just want this to work, I would like to learn why it works, and what does what, so that in the future I can use my acquired knowledge to solve it, instead of making another thread. Quote
TrashCaster Posted September 20, 2015 Author Posted September 20, 2015 Almost a week has gone by, and I've got not a single hint to help me further. I'm really begging here. I would like to solve this issue. Recap: I need a dynamic GL texture to be used on the item model. I have tried remapping the texture atlas sprite as is done with compass and clock. No luck. - both by replacing the the parent value, and by replacing the layer1 value (ie, modid:item/texture) used in the model I have not tried to use a smart model, since I'm only changing the texture based on NBT, and the NBT never has predictable values. (UUID to represent painting images, as they are named that way when saved to disk) I don't know what else to try. Quote
EverythingGames Posted September 20, 2015 Posted September 20, 2015 Almost a week has gone by, and I've got not a single hint to help me further. I'm really begging here. I would like to solve this issue. Recap: I need a dynamic GL texture to be used on the item model. I have tried remapping the texture atlas sprite as is done with compass and clock. No luck. - both by replacing the the parent value, and by replacing the layer1 value (ie, modid:item/texture) used in the model I have not tried to use a smart model, since I'm only changing the texture based on NBT, and the NBT never has predictable values. (UUID to represent painting images, as they are named that way when saved to disk) I don't know what else to try. Your NBT values aren't predictable? I was thinking you pre-determine .JSON models with their own corresponding textures, then in ISmartItemModel return the different textured models based on the NBT value. Quote Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]
TrashCaster Posted September 21, 2015 Author Posted September 21, 2015 You can't define models for data values you don't know. Like I said, I'm using a UUID for the paintings. They are randomly generated. There is a way to do this. I just need to be pointed in the right direction. Quote
TrashCaster Posted September 24, 2015 Author Posted September 24, 2015 Still no solutions? The last thing I want to do is set up 4096 quads in a smart model for each pixel color. That's a lot. There needs to be a simpler and faster way to put the GL texture on the model. Quote
Abastro Posted September 25, 2015 Posted September 25, 2015 Debug if TextureMap#getTextureEntry((your texture name)) exists or not. Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
TrashCaster Posted September 27, 2015 Author Posted September 27, 2015 My custom "TextureCanvas" class replacement, or the base texture? My problem mostly is when I remap the entry at texture stitch time (I don't even know if I should be doing pre, or post. But I have done both) it never calls the update animation method. I tried doing exactly what the compass and clock do (empty animation in the mcmeta file) as well as mapping an extended class to the entry. Those entries are mapped to builtin/compass and builtin/clock. The JSON models for those have their parent set to those, respectively. I tried doing that with my canvas model, and I got the "broken model" issue (the black and pink textured cube/square). I try doing it in a texture field, and still the same. Literally the only thing that has made a dent for me is either to remesh the model with a smart model and each pixel is its own colored quad (kills fps), or to try and use the render player event to render an extra quad manually with the texture bound. The latter does work, but obviously is bad practice for the new system, as well as makes more work for myself (copying transforms and whatnot). I refuse to use render player event though, since I want this to apply to the item model so it could be used anywhere. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.