Jump to content

SoD's Software


SoulofDeity
 Share

Recommended Posts

Just finished cleaning up the API a lot and adding a new Group class. Now there's a set of simple static functions to use:

Actor.Spawn(actor, objectname)

Scene.Load(scene)
Scene.Unload(scene)
Scene.AddGroup(group)
Scene.RemoveGroup(grou)
Scene.AddActor(actor)
Scene.RemoveActor(actor);

Room.Load(room)
Room.Unload(room)
Room.AddObject(object)
Room.RemoveObject(object)

Scene.AddGroup and Scene.RemoveGroup don't need to be called manually, as Scene.AddActor and Scene.RemoveActor will add or remove the groups to the scene as needed. Also, Actor.Spawn is only called to create a new actor during gameplay, not for when constructing maps. As an example, here's the code that creates the default scene:

Assets.Scene scene = new Assets.Scene("Default Scene");

Assets.Actors.DebugCamera ec_actor = new Assets.Actors.DebugCamera();
scene.AddActor(ec_actor);

Assets.Room room = new Assets.Room("Default Room");
scene.AddRoom(room);

Assets.Object ec_object = new Assets.Object(ec_actor, "Debug Camera");
room.AddObject(ec_object);

Assets.Scene.Load(scene);
Assets.Room.Load(room);

Note that you can load several scenes or rooms at once, but only the last one to be called with Scene.Load or Room.Load will be the current scene or room. Looking smexy, right?   :3

  • Like 3
Link to comment
Share on other sites

  • 3 months later...

Since I've had nothing better to do lately, I picked back up on my Blender toolbox plugin.
 

2nuq24n.png2lxcwon.png207oqcj.png

 

 

As you can tell from above, I'm adding new tool-panels for working with objects, collision, animation, and scene settings like environment lighting. I know that it's possible to use GLSL shaders in Blender, but I'm looking to see if I can somehow use CG; since it'd be a piece of cake to import into Unity.

 

 

 

EDIT:

 

It seems CG shaders might not be that difficult after all. I just need to add a new attribute to the Material bpy type that points to the textblock for the cg shader, then for each object assign a sensor and controller for a script that passes the shader to the cgc program from the NVidia CG toolkit to spit out the GLSL vertex and fragment shaders, then assign those to the Material.

 

The only downside is that shaders can only be used with game logic, so I added a convenient "Show Preview" button to the toolbox.

  • Like 4
Link to comment
Share on other sites

Glad to see you working on this, it will allow more options to modding.

 

Thanks   :D

 

I just fixed a slight problem as well. For some reason, cgc wouldn't recognize the modelview projection matrix parameter when generating GLSL code, so to fix it, I was doing a manual string replacement. I searched the actual CG developer site everywhere and couldn't find any information at all, but I eventually found this site which hinted me to use state.matrix.mvp as the parameter hint and it fixed the problem  :3  Now shaders load a little faster.

 

It's still not the fastest though. Every time you click the "Show Preview" button, the CG shaders have to be re-converted to GLSL and compiled. Still, it's really clean, and I think I'm the first person to actually get CG shaders working in Blender.

Link to comment
Share on other sites

Yeah, but if you just convert it with xdaniel's tool, it should work. Of course, I assume you're working on this to import to MM also?

 

Yeah, I'm going to add support for MM scene/room commands if possible. If I used xdan's tool, it'd spit out GLSL code, which isn't what I want. I want to use CG so that you can export them for use in Unity. Btw, it would be nice if xdan or someone could inform me about how the light direction is formatted in the header. I assumed it may have been an 8-bit signed integer euler rotation with range of -180 to 180, but it doesn't seem to be the case. I also thought it might have been a vector, where the light is supposed to look from (0, 0, 0) to (x, y, z), but that doesn't seem to be it either.

Link to comment
Share on other sites

I'm having a lit bit of trouble trying to figure out how replicate the lighting in the game. The best I could come up with was to enable environment lighting from the world properties, create 2 sun lamps with the appropriate colors (one pointing up, the other down) and the ambient sky color set appropriately.

 

The model was imported using the old importer btw, just doing some experiments.

 

 

2qw385f.png

 

 

I'm not entirely certain how accurate this is, it's kinda hard to tell without multitexturing and vertex colors working properly. In the normal 3D view, the scene looks like total shit.

  • Like 1
Link to comment
Share on other sites

After figuring out how that the environment format was wrong, I went back and retried the lighting in blender with the correct colors; this time using ambient occlusion

 

actyqt.png

 

I'm still having trouble getting the lights to face the proper direction, but I think this does look a lot better. However....

 

 

 

I have no idea what the fuck this is about...

 

2l9ntw6.png

 

Link to comment
Share on other sites

Oh damn. Them memory leaks... Or is it supposed to be that demanding on memory?

That actually wasn't even from the script, it just sort of accumulated after I did a couple of dozen renders to test the lighting. However, there is a memory leak problem with the script as well. When you click one of the Actor/Object/Scene tabs, the memory usage spikes a little, even if the tab doesn't actually change. It maxes on ~19.3M. Whatever the problem is, it seems to be Blender itself that's the cause.

Link to comment
Share on other sites

I'm having a lit bit of trouble trying to figure out how replicate the lighting in the game. The best I could come up with was to enable environment lighting from the world properties, create 2 sun lamps with the appropriate colors (one pointing up, the other down) and the ambient sky color set appropriately.

 

The model was imported using the old importer btw, just doing some experiments.

 

 

2qw385f.png

 

 

I'm not entirely certain how accurate this is, it's kinda hard to tell without multitexturing and vertex colors working properly. In the normal 3D view, the scene looks like total shit.

*MUST* have!

 

As you know, I'm a HUGE fan of this thing.  I've had v3_fix fail to export Hyrule Field on my system.  I'm looking forward to the new releases if they are coming.  In the mean time, would you mind posting an OBJ and MTL for Hyrule Field?  Theres another guy who asked for it from me, and I could not get it.

 

But I was wondering why also.  Is it the special textures like the ranch windows that change color at night?  If so, those have been a pain in my side for some time.  Long ago when I was trying to port OoT to Master Quest is when I first noticed the special textures like the windows.  OZMAV handled them by loading in a plain colored texture as a place holder.  I was wondering how it's handled here.

Link to comment
Share on other sites

*MUST* have!

 

As you know, I'm a HUGE fan of this thing.  I've had v3_fix fail to export Hyrule Field on my system.  I'm looking forward to the new releases if they are coming.  In the mean time, would you mind posting an OBJ and MTL for Hyrule Field?  Theres another guy who asked for it from me, and I could not get it.

 

But I was wondering why also.  Is it the special textures like the ranch windows that change color at night?  If so, those have been a pain in my side for some time.  Long ago when I was trying to port OoT to Master Quest is when I first noticed the special textures like the windows.  OZMAV handled them by loading in a plain colored texture as a place holder.  I was wondering how it's handled here.

 

Thanks for the motivation  :3

 

It's better to export the models as FBX because they use vertex colors for shading. Otherwise, your exported model will appear dull and flat. I'm not certain if the ranch windows change color or not, but the new script will allow you to import alternate scene headers. It's likely that the window textures are located in the gameplay_field_keep file. For the V3 script, if you place it in the same directory as the zmap you're importing with the name segment_05.zdata, it might fix it.

Link to comment
Share on other sites

[...] It's likely that the window textures are located in the gameplay_field_keep file. For the V3 script, if you place it in the same directory as the zmap you're importing with the name segment_05.zdata, it might fix it.

They're probably in one of the _keep files, but accessed via segment 0x08, offset 0x0, set up at runtime, same stuff as for texture animation. See ex. here and various other threads about the animations part. Not sure if anyone's ever looked more closely into the corresponding code, aside from apparently DeathBasket in that thread.

Link to comment
Share on other sites

They're probably in one of the _keep files, but accessed via segment 0x08, offset 0x0, set up at runtime, same stuff as for texture animation. See ex. here and various other threads about the animations part. Not sure if anyone's ever looked more closely into the corresponding code, aside from apparently DeathBasket in that thread.

 

If they were accessed via segment 8, my import script wouldn't have loaded them. The only segments I specify when loading scenes are 04 (gameplay keep) and 05 (field/dungeon keep). That animation info will be pretty useful though if I try to tackle that   :)

 

Also, cleaning up the UI a bit to make it less confusing:

 

bij78y.png

 

 

 

EDIT:

 

A bit better. Added audio options and Save/Load/Delete buttons for working with multiple headers and environments. I also added a new 'material' tab which will allow you to specify tile options like format and mirroring. If I can get some info on scene texture animation, I may be able to implement that as well.

 

1z23ynm.png

Link to comment
Share on other sites

This is just me toying around with an idea, replicating the N64 combiner in Blender through the use of nodes.

 

 

jfhf9y.png

 

 

 

 

It actually works rather well. The above shows the equation:

 

Color = (TEXEL0 - 0) * SHADE + PRIMITIVE.

Alpha = (1 - TEXEL0) * 1 + 0

 

Notice that the shade property get the vertex color as input and converts it to grayscale, so in the render the corner of the cube appears darker shaded rather than blue. If there is some way to create and organize nodes from a script, this would be a lot better than using shaders.

 

 

EDIT:

 

An improved node setup that supports 2 passes

 

2nq77tk.png

 

 

This setup should be capable of recreating any combiner mode, with the exception of modes that include the parameters LOD_FRACTION, PRIM_LOD_FRAC, NOISE, CENTER, SCALE, K4, and K5. Though I'm pretty sure none of those parameters are even used in OoT/MM.

  • Like 1
Link to comment
Share on other sites

I had a headache for a majority of the day today, so I just played around in unity.

I imported all of the skyboxes from OoT, wrote custom shaders for gui stuff, imported the bitmap font for the HUD counters, and set up the basic layout of the HUD.
 

znv8tj.png

 

A small getcha though, you can't scale bitmapped fonts in Unity, so the text size would be the same regardless of the resolution; which would make the GUI look like shit. Luckily, I came up with a really neat idea where I would place a back panel just at the edge of an orthographic camera's viewport so it lines up perfectly, then I would align all my custom meshes on top of it the way I want it to, all of the GUI stuff having the same parent. Then, I can scale the entire GUI to match any resolution   :D

 

2zzrxbp.png

 

I used Flotonic's Interface Lift tool and some game snapshots to ensure that everything is perfectly colored and aligned. Although, my shader does need a little tweaking I think.

 

 

 

Edit:

 

~Success. Below is a pic showing that the UI remains aligned even in 16:9 aspect ratio

 

 

 

13yjonp.png

 

  • Like 1
Link to comment
Share on other sites

and before we know it.. we have OoT in unity. oh, one can always dream.

It looks awesome though!

 

A while back, I had a working sun and moon as well with solar flares, which was pretty interesting. But I tossed that project. This little toy is partially why I began getting interesting in improving my import script.

 

EDIT:

 

Took some time to do, but I managed to set up the menu box with the same projection angle as in the actual game.

 

j14uuu.png

 

 

The current texture is just a placeholder, but you can see that each subscreen is cut into 4 parts since that's how they're colored in the game.

  • Like 1
Link to comment
Share on other sites

Got the menu colors and textures working

 

 

 

2mme2b9.png

 

 

 

I need to fix the transparency though. Also, when I made the mesh I thought there were 4 cells per row when there were actually 3, so the color blending offsets are a little off

 

 

Here's what my layout looks like in unity

 

33ynxqo.png

 

 

 

EDIT:

 

Got the transparency working. Was a dumb mistake, I flattened the background with the textures when I exported them   -_-

 

 

 

2ia6ijc.png

 

 

 

EDIT2:

 

Finished extracting the map menu and did an animation test.

 

  • Like 3
Link to comment
Share on other sites

Fixed the sprite backface culling problem, imported Link and a test map, and got my camera system working properly.

 

s4qjk3.png

 

 

I imported Link without primitive colors because I'm going to do that with a shader. Getting this camera layout to work properly was a bit tricky; I ended up having to parent my Skybox, Stellar, and GUI cameras to an object called "RotationCam" and my Default and Alpha cameras to an object called "PositionCam". For camera movement, the position and rotation would be applied to PositionCam, but only the rotation is applied to RotationCam. This ensures that the skybox, sun & moon, and HUD don't move when the camera does.

 

Since the pause menu is rendered on the transparentfx layer though, I had to reparent it to the AlphaCam and adjust it's X and Z scale at runtime to the GUICam aspect ratio. Now, with most of the GUI problems out of the way, I can focus my attention on camera and player movement.

 

I'll eventually need to write a better shader as well that will allow both lighting and vertex colors.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.