Load Doom wads directly into Unity.
(Currently Doom1 shareware wad)
Builds meshes for linedefs and sectors.
Constructs textures directly from WAD.
Creates Unity gameobjects for things.
Has option to override materials and textures.
Open up the test_scene.scene and hit play to load the first map
Change the "Autoload Map" parameter in the WadLoader component to load different map "E1M1" "E1M2" "E1M3"...
You can walk around using arrow keys and open doors with spacebar.
(currently only doortype 1 and it's keycard variants are done)
Asset store package is currently pending for approval, but you can download it here.
Just create a new project and extract the zip contents into /assets
The package contains Doom1 shareware wad.
Download the zip here
DoomLoader for Unity
- Tormentor667
- Posts: 13530
- Joined: Wed Jul 16, 2003 3:52 am
- Contact:
-
- Posts: 5
- Joined: Tue Jan 09, 2018 12:54 pm
Re: DoomLoader for Unity
Version 2 is done. E1M1 and E1M2 are now feature complete, only thing missing is enemy behaviour and item pickups.
Here's a list of the major changes:
Download v2 zip here
Here's a list of the major changes:
- - Removed Vector2D struct and replaced all references with Unity's Vector2
- Added first person weapon, created transparent billboard material and shader
- Made mouselook and WSAD movement
- Implemented sounds for doors, weapon, enemies and linedefs
- You can now shoot enemies and barrels dead
- Created GameManager class and moved stuff from WadLoader into there
- Removed the shader vertex transformation and went with classic gameobject rotation instead
- Enemies now have the 5way sprite system
- Added my AxMath library into the project
- Mesher now has grid of triangle lists for quick querying for sectors
- Removed my own ambient light parameter, the shaders now use Unity's Sky Ambient Light
- Shaders in general are more cleaned up and parameter names are standardized
- Thing's facing is now a separate quaternion decoupled from the object transform rotation
- Added a method to swap switch textures in TextureLoader
- Made a fix for the sector 7 bug in E1M3
- You can now unload maps and thus move from one map to another
- Added a ground stick method to player object for smoother elevator movement
Download v2 zip here
Re: DoomLoader for Unity
May I ask how the sprite rotations / view angles are handled in this system? Is it purely shader-based or does the billboard sprite object rotate towards the camera's rotation every frame and select the viewing angle frame at the same time? I'm asking because I am working on a remake of Hired Guns and with four cameras active at the same time the only way to handle billboard sprites was to do it like I described for every camera, every frame.
-
- Posts: 5
- Joined: Tue Jan 09, 2018 12:54 pm
Re: DoomLoader for Unity
In the first version I had a vertex shader code that transformed it towards camera, but I had some issues with camera looking up and down (the sprite would tilt into walls as it did not retain it's up-direction), also bounding boxes doesn't update correctly when doing it in shader, so in the v2 I'm using standard unity transform rotation to look towards camera.
It is possible to do it in shader, keeping the y = up. I'll look into it later, since the current system is working. I know if anyone wants to port their insane 1000 monster map into the game it might become unnecessary overhead to update every object every frame.
Here is the vertex shader code from v1, it works in true billboard fashion (doesn't keep y = up)
note that you need to have "DisableBatching" = "True" tag in the subshader or you will have problem when having multiple same sprites on screen.
By the way, love your work on Hired Guns mod. Glad to hear you are still working on it, the editor from couple years ago looked awesome!
It is possible to do it in shader, keeping the y = up. I'll look into it later, since the current system is working. I know if anyone wants to port their insane 1000 monster map into the game it might become unnecessary overhead to update every object every frame.
Here is the vertex shader code from v1, it works in true billboard fashion (doesn't keep y = up)
Code: Select all
//rotate to face camera
output.pos = mul(UNITY_MATRIX_P,
mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
+ float4(input.vertex.x, input.vertex.y, 0.0, 0.0)
* float4(_ScaleX, _ScaleY, 1.0, 1.0));
By the way, love your work on Hired Guns mod. Glad to hear you are still working on it, the editor from couple years ago looked awesome!
-
- Posts: 5
- Joined: Tue Jan 09, 2018 12:54 pm
Re: DoomLoader for Unity
Sorry for double posting, my account is so new I need to get my posts verified by an adult
I found a vertex program that lets you rotate only around y-axis. I can cook you up an example shader later today after I get back from work.
Found it from https://forum.unity.com/threads/shader- ... ay.439577/
I found a vertex program that lets you rotate only around y-axis. I can cook you up an example shader later today after I get back from work.
Code: Select all
// rotate always towards camera
void Billboard(inout appdata_t v)
{
const float3 local = float3(v.localpos.x, v.localpos.y, 0); // this is the quad verts as generated by MakeMesh.cs in the localPos list.
const float3 offset = v.vertex.xyz - local;
const float3 upVector = half3(0, 1, 0);
const float3 forwardVector = UNITY_MATRIX_IT_MV[2].xyz; // camera forward
const float3 rightVector = normalize(cross(forwardVector, upVector));
float3 position = 0;
position += local.x * rightVector;
position += local.y * upVector;
position += local.z * forwardVector;
v.vertex = float4(offset + position, 1);
v.normal = forwardVector;
}
-
- Posts: 5
- Joined: Tue Jan 09, 2018 12:54 pm
Re: DoomLoader for Unity
First three maps are now fully playable.
https://cp.sync.com/dl/67f0b4380#kr5b3t ... p-xhkeeyvq
Create a new Unity project and extract the zip contents into assets, open up the /assets/DoomLoader/test_scene.unity and hit play
https://cp.sync.com/dl/67f0b4380#kr5b3t ... p-xhkeeyvq
Create a new Unity project and extract the zip contents into assets, open up the /assets/DoomLoader/test_scene.unity and hit play