HD Pre-rendered Daggerfall Sprites

Show off your mod creations or just a work in progress.
Post Reply
User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by pango »

jedidia wrote: Wed Dec 12, 2018 2:30 pm Finally, I'm almost certain it would require code support. There's some switch in there that chooses the correct sprite row depending on camera position and character orientation, that would need to be updated.
Sure, there's some logic to determine what sprite to use based on user point of view, and I think it's currently hardcoded for 45° subdivisions. I suppose it would not be too difficult to modify it to support a different number of subdivisions (that's totally unrelated to allowing NPCs diagonal movements).
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by MasonFace »

If you want, you could use a Unity asset that I'm developing to render the 3D model into a sprite inside Unity in real-time. It would benefit from high levels of customization and real-time lighting. You can customize the FPS of the animation, number of discrete view angles (4, 8, or 16), resolution of the sprite, bilinear/point filtering, and 16 or 32 bit color depth all-on-the-fly. Also, it doesn't store a texture atlas, so your video memory isn't dependent on the number of frames or animations. On the downside, it does require that the model be rendered once every so many frames in order to update the Render Texture so that counts against your video memory, but the simple materials you appear to be using (which I love by the way) shouldn't be a very heavy hit.

Take a look at what I have so far and see what you think: https://www.youtube.com/watch?v=RwndXT2K6Ms

Sorry the video is kind of dark; it's my first time making a demo video and I was trying to emphasis the real-time lighting.

The "code switch" mentioned by Jedidia would be taken care of automatically by my Asset which compares the main camera's view angle to the subject's orientation, then descretizes it to snap it into a 45 degree (or whatever interval you want) angle. But on the other hand, I don't think DFU supports swapping character sprites with animated 3D models yet (I'm speaking in ignorance here) so it may be a moot point for now anyhow.


BTW, the video features a ground texture made by our very own KoW (credited in the video description).

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: HD Pre-rendered Daggerfall Sprites

Post by TheLacus »

MasonFace wrote: Wed Dec 12, 2018 6:26 pm The "code switch" mentioned by Jedidia would be taken care of automatically by my Asset which compares the main camera's view angle to the subject's orientation, then descretizes it to snap it into a 45 degree (or whatever interval you want) angle. But on the other hand, I don't think DFU supports swapping character sprites with animated 3D models yet (I'm speaking in ignorance here) so it may be a moot point for now anyhow.
Only for interior npcs, which are static (but you can potentially do a lot with a custom component on the prefab). Now I'm tempted to take the occasion and add a hook also for wandering npcs. :)
I think the idea is to allow a gameobject to replace MobilePersonBillboard child on the prefab, then it would need a way to communicate with core. Maybe MobilePersonBillboard component could be derived from an abstract MobilePersonAsset or similar, so each mod can implement its own animation behaviour.

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by MasonFace »

Now I'm tempted to take the occasion and add a hook also for wandering npcs. :)
While we're on the topic of swapping NPCs with 3D models and API hooks, could we discuss (at the risk of derailing Kamer's original topic :oops: ) the possibility of customized LODs?

In an old topic by NikitaThetanner (viewtopic.php?f=22&t=466), it was discussed what route to dedicate a limited talent pool towards in terms of production of 3D assets. I don't know that a solid consensus was ever reached, but with a bit of programming perhaps we can satisfy nearly all tastes with a singular source of high quality base assets (I'm looking at you, Kamer ;) ).

My idea is predicated on an assumption of Unity's LODGroup class that the Renderers can be assigned by script into the LOD[] array using SetLODs. If that's true, then adding a modding hook could allow DFU to build the LOD groups to suite the user's preferred aesthetic. Of course this would require that the content creator would have to create asset's at various quality levels to fill these LOD[] slots, but it's fairly simple to reduce the polycount of a high poly asset and/or bake into sprites; not so much the other way around.

Using this method, the user can select a mode that generates the LODs to suite that aesthetic.
For example: a high quality mode that assigns LOD[0] the high quality 3D model, LOD[1] a low polycount model to be used at a distance for performance, and LOD[2] baked sprites at the farthest distance.
Other settings could include LOD[0] being the low poly model and LOD[1] being the baked sprites with no additional LODs.
Or finally, LOD[0] being the baked sprites and no other LODs.

Configuring the LOD groups before loading into DFU should mean that nothing of greater quality than what the user wants ever gets loaded into memory (here I go assuming again).

Another hook could simply enable my Spriter asset on either the high or low poly model to enable dynamic sprites. This is the most future proof sprite option since it is totally agnostic to custom animations... I'm just imagining sneaking up and backstabbing a thief that's looting a fresh corpse in a dungeon. In my mind, the thief is a sprite, but he has dynamic shadows rendered on him and he's performing an animation loop where he's reaching on the ground and looking around in a paranoid fashion.

Again, I apologize if I derail the original topic. We can discuss this in a new topic in the Modder Discussion board if that's more appropriate.
Last edited by MasonFace on Tue Aug 20, 2019 4:16 pm, edited 1 time in total.

User avatar
VMblast
Posts: 519
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by VMblast »

MasonFace wrote: Wed Dec 12, 2018 6:26 pm Take a look at what I have so far and see what you think: https://www.youtube.com/watch?v=RwndXT2K6Ms
That is awesome, really great job! :)

I would just make two suggestions. First one is that you can use Bink Video and set sprites as movie file. That way you can greatly increase resolution and frames per second (as well viewing angles), without any significant cost. https://twitter.com/jurney/status/46637 ... Rl5tn2pEg0

And second suggestion is to change name of the unity plugin -there is already spriter software (as well their plugin for unity). Its just a bit confusing and makes search impossible. :P

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: HD Pre-rendered Daggerfall Sprites

Post by Nystul »

VMblast wrote: Thu Dec 13, 2018 9:20 am
MasonFace wrote: Wed Dec 12, 2018 6:26 pm Take a look at what I have so far and see what you think: https://www.youtube.com/watch?v=RwndXT2K6Ms
That is awesome, really great job! :)

I would just make two suggestions. First one is that you can use Bink Video and set sprites as movie file. That way you can greatly increase resolution and frames per second (as well viewing angles), without any significant cost. https://twitter.com/jurney/status/46637 ... Rl5tn2pEg0

And second suggestion is to change name of the unity plugin -there is already spriter software (as well their plugin for unity). Its just a bit confusing and makes search impossible. :P
since the same technology is also known as "imposters" or "imposter system" it would be a good idea to take this into account when thinking about a different name and search for similar assets in the store

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by MasonFace »

I'll have to look more into the Bink thing. Sounds very interesting, but it could depend on having a particular graphics card. Currently, I'm using render textures from scene camera's to capture a snapshot of the mesh from a given angle, then moving the mesh to a layer that isn't seen by any cameras until the sprite needs to be updated again. The "sprite" is just a quad that has the render texture on it and is billboarded to always face the player. So basically, I'm grabbing pixel data straight from the GPU and rendering onto a quad, so I don't think the Bink solution would help in this situation since I assume it's doing the same thing, but I'll still do some studying on it. Honestly, I'm actually only limiting the FPS and resolution for aesthetics, not performance.

I searched the Unity Asset Store to see if the "Spriter" name had been taken but couldn't find any results, but I just did a Google search and it does look like someone has made an Asset with that name. I wasn't married to that name anyhow. I'm open to suggestions if you guys want to DM me. How is Dynamic Sprite System (DynaSSyst) ?

Anyhow, I don't want to pull attention away from Kamer's incredible work. I'll create a separate post for this discussion.

Kamer, would you be willing to share your meshes with me to do some tests?

User avatar
VMblast
Posts: 519
Joined: Wed Mar 29, 2017 12:22 pm
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by VMblast »

MasonFace wrote: Thu Dec 13, 2018 4:50 pm I'll have to look more into the Bink thing. Sounds very interesting, but it could depend on having a particular graphics card. Currently, I'm using render textures from scene camera's to capture a snapshot of the mesh from a given angle, then moving the mesh to a layer that isn't seen by any cameras until the sprite needs to be updated again. The "sprite" is just a quad that has the render texture on it and is billboarded to always face the player. So basically, I'm grabbing pixel data straight from the GPU and rendering onto a quad, so I don't think the Bink solution would help in this situation since I assume it's doing the same thing, but I'll still do some studying on it. Honestly, I'm actually only limiting the FPS and resolution for aesthetics, not performance.
How did you make your sprites to be able to get lighten by the ingame lights? Sprite normal maps?

Do you need to have 3D models in the scene for this spriter to work?

I assume it is impossible to have angled sprite, like from above (or at least 45 degrees), right?

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: HD Pre-rendered Daggerfall Sprites

Post by MasonFace »

How did you make your sprites to be able to get lighten by the ingame lights? Sprite normal maps?
Nope, each 3D model that I want rendered as a sprite has its own camera. The 3D model, let's call it the subject is assigned to a layer that only its camera can see. This subject receives lighting information from world lights and can cast shadows on itself. The subject's camera stores its raw pixel output, which is the illuminated subject with the background set to full transparency, into a Render Texture. This Render Texture is then used as the texture on a quad that is scripted to always face the player (billboarding). All this happens only when the sprite needs to be updated which is based on the chosen FPS of the sprite animation or whenever the view angle of the sprite changes.
Do you need to have 3D models in the scene for this spriter to work?
Yes, but it is only rendered for 1 frame, again depending on the FPS or when the view angle changes. As such, it will add draw calls during that one frame, but averaged out over the multiple frames between updates, it isn't much of a performance hit.
I assume it is impossible to have angled sprite, like from above (or at least 45 degrees), right?
Are you asking if you can change the perspective so that you can look down onto a sprite from above? You certainly can. I would have to script in an offset for the camera to change it's perspective so it is above the subject and looking down.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: HD Pre-rendered Daggerfall Sprites

Post by TheLacus »

MasonFace wrote: Thu Dec 13, 2018 2:15 am
Now I'm tempted to take the occasion and add a hook also for wandering npcs. :)
While we're on the topic of swapping NPCs with 3D models and API hooks, could we discuss (at the risk of derailing Kamer's original topic :oops: ) the possibility of customized LODs?

In an old topic by NikitaThetanner (https://forums.dfworkshop.net/viewtopic.php?f=22&t=466), it was discussed what route to dedicate a limited talent pool towards in terms of production of 3D assets. I don't know that a solid consensus was ever reached, but with a bit of programming perhaps we can satisfy nearly all tastes with a singular source of high quality base assets (I'm looking at you, Kamer ;) ).

My idea is predicated on an assumption of Unity's LODGroup class that the Renderers can be assigned by script into the LOD[] array using SetLODs. If that's true, then adding a modding hook could allow DFU to build the LOD groups to suite the user's preferred aesthetic. Of course this would require that the content creator would have to create asset's at various quality levels to fill these LOD[] slots, but it's fairly simple to reduce the polycount of a high poly asset and/or bake into sprites; not so much the other way around.

Using this method, the user can select a mode that generates the LODs to suite that aesthetic.
For example: a high quality mode that assigns LOD[0] the high quality 3D model, LOD[1] a low polycount model to be used at a distance for performance, and LOD[2] baked sprites at the farthest distance.
Other settings could include LOD[0] being the low poly model and LOD[1] being the baked sprites with no additional LODs.
Or finally, LOD[0] being the baked sprites and no other LODs.

Configuring the LOD groups before loading into DFU should mean that nothing of greater quality than what the user wants ever gets loaded into memory (here I go assuming again).
Using LOD to satisfy the need for multiple artistic styles is an intriguing idea. I don't think any change is needed in core, though. I might need to look more into how LOD works in Unity, but I think that what you propose can be implemented with a custom component on the injected prefab. This one could read mod settings and import the required resources from assetbundle and/or set LOD group options as needed.

I think i also wouldn't exclude making two mods with the same meshes but LODs organized differently. It may require more manual work but in the end it would also be more performant and would allow the modeler to make any required adjustement, i think.
MasonFace wrote: Thu Dec 13, 2018 2:15 am Another hook could simply enable my "Spriter" asset on either the high or low poly model to enable dynamic sprites. This is the most future proof sprite option since it is totally agnostic to custom animations... I'm just imagining sneaking up and backstabbing a thief that's looting a fresh corpse in a dungeon. In my mind, the thief is a sprite, but he has dynamic shadows rendered on him and he's performing an animation loop where he's reaching on the ground and looking around in a paranoid fashion.

Again, I apologize if I derail the original topic. We can discuss this in a new topic in the Modder Discussion board if that's more appropriate.
My idea for npcs, likes all other models, is to import gameobjects from assetbundles, following a standard nomeclature. Since i've recenlty introduced a workaround for serialization of imported scripts, your tool might work just fine if you add the required components on the prefab. Hopefully we'll be able to experiment soon. :)

Post Reply