Tutorial How to make 3DS Games with Unity

Should I add some Demo Projects?


  • Total voters
    54
  • Poll closed .

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
Thanks a lot for the overview it has a lot of information =D
but when make the Texture Type to " Default " it can't imported to the scene
I am not sure if I am doing it right, did you use Photoshop?
also can you send me the same image.tga to try it? or the shader code

HUGE THANKS
Post automatically merged:

also Video player if there any wat to make it works
"Texture Type to " Default " it can't imported to the scene" should be default when importing. what is it set to for your texture?

Yes I am using Photoshop. What are you using?

Can you upload the texture you are trying to use so I can take a look at it?

I can not upload a TGA file but I can upload this PNG file that has transparency. You can use this for testing :)
One_Meter_Grid_1024.png
 
Last edited by Th3Travler,
  • Like
Reactions: AliSd

AliSd

Active Member
Newcomer
Joined
Nov 12, 2022
Messages
28
Trophies
0
Age
34
XP
161
Country
United Kingdom
"Texture Type to " Default " it can't imported to the scene" should be default when importing. what is it set to for your texture?

Yes I am using Photoshop. What are you using?

Can you upload the texture you are trying to use so I can take a look at it?

I can not upload a TGA file but I can upload this PNG file that has transparency. You can use this for testing :)

"Texture Type to " Default " it can't imported to the scene" should be default when importing. what is it set to for your texture?

Yes I am using Photoshop. What are you using?

Can you upload the texture you are trying to use so I can take a look at it?

I can not upload a TGA file but I can upload this PNG file that has transparency. You can use this for testing :)
View attachment 468770
Sorry for the late replay, I was unable to use this file, I don't know why, I got this message below
Screenshot 2024-11-11 084218.png
What I want to make is just fade effect and shadow effect

Thanks again =D
 

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
Sorry for the late replay, I was unable to use this file, I don't know why, I got this message belowView attachment 470580 What I want to make is just fade effect and shadow effect

Thanks again =D
you can attach png files here. please attach the texture so I can take a look at it :)
also know that a 1024 is a rather large texture for the 3DS.

Sounds like you want to do a projection effect? what material are you using?
 

AliSd

Active Member
Newcomer
Joined
Nov 12, 2022
Messages
28
Trophies
0
Age
34
XP
161
Country
United Kingdom
you can attach png files here. please attach the texture so I can take a look at it :)
also know that a 1024 is a rather large texture for the 3DS.

Sounds like you want to do a projection effect? what material are you using?
I have this PNG file
Solid_black.png

it's only black

and this is the problem :-

Screenshot 2024-11-11 105730.png

Even when change the transparency it still soled black black, I don't know why, I only want it to be like 50% clear

Screenshot 2024-11-11 105620.png

in a real hardware it could be 100% or 0%
Post automatically merged:

I have this PNG file
Solid_black.png

it's only black

and this is the problem :-

Screenshot 2024-11-11 105730.png

Even when change the transparency it still soled black black, I don't know why, I only want it to be like 50% clear

Screenshot 2024-11-11 105620.png

in a real hardware it could be 100% or 0%
and here is what I expected :-



Screenshot 2024-11-11 111712.png

Post automatically merged:

you can attach png files here. please attach the texture so I can take a look at it :)
also know that a 1024 is a rather large texture for the 3DS.

Sounds like you want to do a projection effect? what material are you using?
Well, I got a temporary solution !!!
I just rendered black screen with transparency animation starting from 100% and ends with 0% and this one works for me

Thanks for your help <3
 
Last edited by AliSd,

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
I have this PNG file
View attachment 470603
it's only black

and this is the problem :-

View attachment 470605
Even when change the transparency it still soled black black, I don't know why, I only want it to be like 50% clear

View attachment 470604
in a real hardware it could be 100% or 0%
Post automatically merged:


and here is what I expected :-



View attachment 470606
Post automatically merged:


Well, I got a temporary solution !!!
I just rendered black screen with transparency animation starting from 100% and ends with 0% and this one works for me

Thanks for your help <3


yeah happy to help :) ok so I see the problem.

1. you texture is not a power of 2
1731319007292.png

All game textures that will live in 3D space must be power of 2. this helps video cards quickly processes
the bit data.

16 x
32 x
64 x
128 x
256 x
512 x
1024 x
2048 x
Texture can be ONLY one of those sizes if its in 3D space - only UI textures can sorta ignore this rule. Id shoot to still be power of 2 when ever possible for UI and always for 3d models or anything in the game space that is not UI.
You can do combinations of these sizes as well - my advice is to keep the textures horizontal length as the bigger value if going for none uniform sizes. do not go smaller than 16 some video cards don't like such small values and tiling can be just as expensive as transparency if done wrong. For the 3DS I recommend keeping your textures between 1024 and 32 pixels. No bigger or smaller than that and try to make the vast amount of your textures 128 or 256. Lastly I get that not everything fits neatly in these sizes. it just part of the game development charm :)

32 x 32
1731319700567.png


256 x 1024
1731319592106.png




2. next the texture does not have an Alpha -
1731319366893.png



I would recommend an image size of 128x128 with Alpha saved as tga ( normal tga ) not a NW4C TGA!
i will upload this one for you. I/m not clear how it is that you want your texture to be transparent so ill make this as an example and a 50% all transparent.
1731320019083.png

I'm glad you found a solution via animation didn't even know you could do that very cool to Know!
Ill still upload these so other can learn too.


SETUP the Texture in UNITY
Lastly I do want to point out how these textures and materials need to be setup:
for The texture make sure...

1. Alpha source is Input Texture Alpha
2. Overide for Nintendo 3DS is checked
3. make sure max size is correct
4. Make sure the compression has an A in it for Alpha.
1731321495185.png

1731321730244.png

ETC is better compression but causes more banding, RGBA 32bit will have smoother transparancy but the file size will be bigger. Since this is a Black and white image you can also use Alpha 8

You will of course get better results with a TGA than a PNG since PNG's have compression baked in.
below I have a TGA 128x128 and a PNG 128x128 as you can see the tga has a much smoother transparency. While the PNG
has Banding no matter what 3DS compression you use, while the TGA can vary in banding based off compression?
Here the TGA is set to RGBA 32 BIT which is the least compression but largest file size. You have to play with compression to see what will work best for a given texture.
1731322300151.png


SETUP the Material in UNITY
Lastly you have to select a material that will have transparency.
bare in mind unity and the 3DS are not the same thing. just cause it works in Unity does not mean it will translate to the 3DS. Always test on hardware. To use these textures with Alpha you must select a shader that is transparent and compatible with the 3DS.

Use Legacy Shaders / Transparent / Diffuse
1731322828670.png

This will ensure it will work on the 3DS

Here are the files I made in photoshop - as you know I sadly cannot upload TGA's
both are 128x128

Solid_black_Ramp.png
Solid_black_50.png
 

Attachments

  • Solid_black_Ramp.png
    Solid_black_Ramp.png
    7 KB · Views: 7
  • Solid_black_50.png
    Solid_black_50.png
    3.1 KB · Views: 8
  • Solid_black_50.png
    Solid_black_50.png
    3 KB · Views: 9
Last edited by Th3Travler,
  • Like
Reactions: AliSd

AliSd

Active Member
Newcomer
Joined
Nov 12, 2022
Messages
28
Trophies
0
Age
34
XP
161
Country
United Kingdom
yeah happy to help :) ok so I see the problem.

1. you texture is not a power of 2
View attachment 470615
All game textures that will live in 3D space must be power of 2. this helps video cards quickly processes
the bit data.

16 x
32 x
64 x
128 x
256 x
512 x
1024 x
2048 x
Texture can be ONLY one of those sizes if its in 3D space - only UI textures can sorta ignore this rule. Id shoot to still be power of 2 when ever possible for UI and always for 3d models or anything in the game space that is not UI.
You can do combinations of these sizes as well - my advice is to keep the textures horizontal length as the bigger value if going for none uniform sizes. do not go smaller than 16 some video cards don't like such small values and tiling can be just as expensive as transparency if done wrong. For the 3DS I recommend keeping your textures between 1024 and 32 pixels. No bigger or smaller than that and try to make the vast amount of your textures 128 or 256. Lastly I get that not everything fits neatly in these sizes. it just part of the game development charm :)

32 x 32
View attachment 470619

256 x 1024
View attachment 470618



2. next the texture does not have an Alpha -
View attachment 470617


I would recommend an image size of 128x128 with Alpha saved as tga ( normal tga ) not a NW4C TGA!
i will upload this one for you. I/m not clear how it is that you want your texture to be transparent so ill make this as an example and a 50% all transparent.
View attachment 470620
I'm glad you found a solution via animation didn't even know you could do that very cool to Know!
Ill still upload these so other can learn too.


SETUP the Texture in UNITY
Lastly I do want to point out how these textures and materials need to be setup:
for The texture make sure...

1. Alpha source is Input Texture Alpha
2. Overide for Nintendo 3DS is checked
3. make sure max size is correct
4. Make sure the compression has an A in it for Alpha.
View attachment 470621
View attachment 470623
ETC is better compression but causes more banding, RGBA 32bit will have smoother transparancy but the file size will be bigger. Since this is a Black and white image you can also use Alpha 8

You will of course get better results with a TGA than a PNG since PNG's have compression baked in.
below I have a TGA 128x128 and a PNG 128x128 as you can see the tga has a much smoother transparency. While the PNG
has Banding no matter what 3DS compression you use, while the TGA can vary in banding based off compression?
Here the TGA is set to RGBA 32 BIT which is the least compression but largest file size. You have to play with compression to see what will work best for a given texture.
View attachment 470624

SETUP the Material in UNITY
Lastly you have to select a material that will have transparency.
bare in mind unity and the 3DS are not the same thing. just cause it works in Unity does not mean it will translate to the 3DS. Always test on hardware. To use these textures with Alpha you must select a shader that is transparent and compatible with the 3DS.

Use Legacy Shaders / Transparent / Diffuse
View attachment 470625
This will ensure it will work on the 3DS

Here are the files I made in photoshop - as you know I sadly cannot upload TGA's
both are 128x128

View attachment 470630View attachment 470631
Thanks I appreciate that
THANK YOU SO MUCH !!!
 
  • Like
Reactions: Th3Travler

Ventuaer

Member
Newcomer
Joined
Aug 2, 2024
Messages
11
Trophies
0
Age
25
XP
74
Country
Czech Republic
Sorry to hijack this thread, but. I have been struggling to make a dynamic shader/script for changing texture of a character.
All attempts have worked in unity, but not on real hardware & citra.

For the model I am trying to use a texture made of a base color and one png layered on top (well below the 512x512 limits). Did a shader that works wonders in unity. It however, does not work in the real game.

I've also tried to implement a blinking animation using a script, it worked, but failed to do so on the real hardware. In the start function I created two textures and assigned them to 2 materials and swapped betwen the textures to create a blinking effect.

Any and all shader attempts so far have resulted poorly.. What am I doing wrong? :(

(and I am quite sure it should be possible, since this exists: https://gbatemp.net/threads/unity-3ds-shader.501169/, but I've been unable to try to use it)
 
Last edited by Ventuaer,

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
Sorry to hijack this thread, but. I have been struggling to make a dynamic shader/script for changing texture of a character.
All attempts have worked in unity, but not on real hardware & citra.

For the model I am trying to use a texture made of a base color and one png layered on top (well below the 512x512 limits). Did a shader that works wonders in unity. It however, does not work in the real game.

I've also tried to implement a blinking animation using a script, it worked, but failed to do so on the real hardware. In the start function I created two textures and assigned them to 2 materials and swapped between the textures to create a blinking effect.

Any and all shader attempts so far have resulted poorly.. What am I doing wrong? :(

(and I am quite sure it should be possible, since this exists: https://gbatemp.net/threads/unity-3ds-shader.501169/, but I've been unable to try to use it)
I use this place for troubleshooting so at least to me all 3DS questions are welcome :)

you can use 1024x1024's - as a matter of fact I using quite a few as a texture atlas reduces draw calls
they just vram heavy.

That is a tricky shader to write - you have to use a Texture combiner to do it you cant use a GL es 2.0 fragment shader.
which is what typically most people are use to writing.
Now when you say dynamically changing the texture do you mean - straight swapping out 1 texture for another? or do you mean changing the colors dynamically of that texture using a alpha channel mask to only affect certain certain parts of the texture? Also do you want the color/texture change to be dynamically affected via code?
 

Ventuaer

Member
Newcomer
Joined
Aug 2, 2024
Messages
11
Trophies
0
Age
25
XP
74
Country
Czech Republic
I use this place for troubleshooting so at least to me all 3DS questions are welcome :)

you can use 1024x1024's - as a matter of fact I using quite a few as a texture atlas reduces draw calls
they just vram heavy.

That is a tricky shader to write - you have to use a Texture combiner to do it you cant use a GL es 2.0 fragment shader.
which is what typically most people are use to writing.
Now when you say dynamically changing the texture do you mean - straight swapping out 1 texture for another? or do you mean changing the colors dynamically of that texture using a alpha channel mask to only affect certain certain parts of the texture? Also do you want the color/texture change to be dynamically affected via code?
Thanks for the reply!

I was thinking about two different things:
a) how to during runtime create a texture (either from color + png, or base_png + overlay texture on top, think of the overlay as an another layer in a graphics program), which technically should be easily doable with some shader, but such that it works for the 3DS
This is the code that works for
Code:
Shader "Custom/OverlayWithBaseColor"
{
    Properties
    {
        _MainTex ("Base Texture", 2D) = "white" {}
        _OverlayTex ("Overlay Texture", 2D) = "white" {}
        _BaseColor ("Base Color", Color) = (1,1,1,1)
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _MainTex;
        sampler2D _OverlayTex;
        fixed4 _BaseColor;

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_OverlayTex;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            // Sample base texture and overlay texture
            fixed4 baseTex = tex2D(_MainTex, IN.uv_MainTex) * _BaseColor;
            fixed4 overlayTex = tex2D(_OverlayTex, IN.uv_OverlayTex);

            // Combine base and overlay
            o.Albedo = baseTex.rgb * (1.0 - overlayTex.a) + overlayTex.rgb * overlayTex.a;
            o.Alpha = baseTex.a * (1.0 - overlayTex.a) + overlayTex.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

b) create a blinking animation, I was at least able to get it to work in unity nby swappnig the texture's pointers (I assume it's pointers and not me swapping the actual texture), this is how it looks like:

C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlinkingAnimation : MonoBehaviour
{
    public Material openEyeMaterial; // Assigned via Inspector
    public Material closedEyeMaterial; // Assigned via Inspector

    public Renderer player; // The Renderer of the player model

    private float blinkTimer;
    private float blinkInterval = 5.0f;
    private float blinkDuration = 0.2f;

    void Start()
    {
        // Load textures from Resources
        // files must be loaded in Assets/Resources/Textures/...., and their file ending trimmed.
        Texture2D baseTexture = Resources.Load<Texture2D>("Textures/base");
        Texture2D openEyeTexture = Resources.Load<Texture2D>("Textures/EyeClosed");
        Texture2D closedEyeTexture = Resources.Load<Texture2D>("Textures/EyeOpen");


        if (baseTexture == null  ||  openEyeTexture == null  || closedEyeTexture == null )
        {
            Debug.LogError("One or more textures could not be loaded. Check the paths in Resources.");
            return;
        }

        // Assign the base texture to the materials
        AssignMaterialTexture(openEyeMaterial, baseTexture, openEyeTexture);
        AssignMaterialTexture(closedEyeMaterial, baseTexture, closedEyeTexture);

        // Set initial material
        if (player != null && openEyeMaterial != null)
        {
            player.material = openEyeMaterial;
        }

        blinkTimer = blinkInterval;
    }

    void Update()
    {
        blinkTimer -= Time.deltaTime;

        if (blinkTimer <= 0)
        {
            StartCoroutine(Blink());
            blinkTimer = blinkInterval + Random.Range(-1.0f, 1.0f);
        }
    }
    
    //this code does the "exchange of textures"
    private IEnumerator Blink()
    {
        Texture openEyeMat = openEyeMaterial.mainTexture;
        openEyeMaterial.mainTexture = closedEyeMaterial.mainTexture;
        closedEyeMaterial.mainTexture = openEyeMat;

        yield return new WaitForSeconds(blinkDuration);
        openEyeMat = openEyeMaterial.mainTexture;
        openEyeMaterial.mainTexture = closedEyeMaterial.mainTexture;
        closedEyeMaterial.mainTexture = openEyeMat;
    }

    private void AssignMaterialTexture(Material material, Texture2D baseTexture, Texture2D overlayTexture)
    {
        if (material == null)
        {
            Debug.LogError("Material is not assigned in the Inspector.");
            return;
        }

        Texture2D combinedTexture = Merge(baseTexture, overlayTexture);
        material.mainTexture = combinedTexture;
    }
    //from some older stackoverflow, not my code. But it works to create a merged image
    public static Texture2D Merge(params Texture2D[] textures) {
        if (textures == null || textures.Length == 0)
            return null;
        int oldQuality = QualitySettings.GetQualityLevel();
        QualitySettings.SetQualityLevel(5);
        RenderTexture renderTex = RenderTexture.GetTemporary(
        textures[0].width,
        textures[0].height,
        0,
        RenderTextureFormat.Default,
        RenderTextureReadWrite.Linear);

        Graphics.Blit(textures[0], renderTex);
        RenderTexture previous = RenderTexture.active;
        RenderTexture.active = renderTex;
        GL.PushMatrix();
        GL.LoadPixelMatrix(0, textures[0].width, textures[0].height, 0);
        for (int i = 1; i < textures.Length; i++)
            Graphics.DrawTexture(new Rect(0, 0, textures[0].width, textures[0].height), textures[i]);
        GL.PopMatrix();
        Texture2D readableText = new Texture2D(textures[0].width, textures[0].height);
        readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
        readableText.Apply();
        RenderTexture.active = previous;
        RenderTexture.ReleaseTemporary(renderTex);
        QualitySettings.SetQualityLevel(oldQuality);
        return readableText;
    }
}
 

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
humm the Surface Function may not be converting to GL ES 1.1
I have not seen any Surface shaders in any Unity 3DS projects. most are either simple fragment shaders or texture combiners. I honestly have no idea of the 3DS shader converter script will convert that shader type. I recommend writing all your shaders as either fragment or texture combiner.

now as for the effect...it sounds like you want a blinking light effect in your texture correct?

Could you show the texture or the part of the texture you want to blink? doesn't need to be full rez or anything

I ask because there are a few different ways to tackle this effect pending what the effect is
that may be much easier and doesn't involve writing a new shader and a timing script...well sorta It may require writing a scrolling shader..which will need a custom timing script so LOL
:lol: ok its no simpler to make but one will be easier to use and explain than the other one.

Either way I can help just want to clearly understand the desired effect you going for :)

Also know that using Time.deltaTime over very long periods of time on the 3DS can cause float point errors past a few hours - I wrote a custom time.deltatime shader script that would reset time based shaders after 30 mins. had the game running all night till morning with no float point errors. prior to that I had a jittery vertex jumbled mess.

Tip:
I recommended leavening your gaming running over night on hardware to see what it might do. you will be surprised how much deltatime stuff breaks over time on 3DS hardware.
A pc or emulator doesn't translate this stuff since a PC has signifiganly better hardware.
 

Ventuaer

Member
Newcomer
Joined
Aug 2, 2024
Messages
11
Trophies
0
Age
25
XP
74
Country
Czech Republic
humm the Surface Function may not be converting to GL ES 1.1
I have not seen any Surface shaders in any Unity 3DS projects. most are either simple fragment shaders or texture combiners. I honestly have no idea of the 3DS shader converter script will convert that shader type. I recommend writing all your shaders as either fragment or texture combiner.

now as for the effect...it sounds like you want a blinking light effect in your texture correct?

Could you show the texture or the part of the texture you want to blink? doesn't need to be full rez or anything

I ask because there are a few different ways to tackle this effect pending what the effect is
that may be much easier and doesn't involve writing a new shader and a timing script...well sorta It may require writing a scrolling shader..which will need a custom timing script so LOL
:lol: ok its no simpler to make but one will be easier to use and explain than the other one.

Either way I can help just want to clearly understand the desired effect you going for :)

Also know that using Time.deltaTime over very long periods of time on the 3DS can cause float point errors past a few hours - I wrote a custom time.deltatime shader script that would reset time based shaders after 30 mins. had the game running all night till morning with no float point errors. prior to that I had a jittery vertex jumbled mess.

Tip:
I recommended leavening your gaming running over night on hardware to see what it might do. you will be surprised how much deltatime stuff breaks over time on 3DS hardware.
A pc or emulator doesn't translate this stuff since a PC has signifiganly better hardware.
The unity that I have (according to my docs) says that it should support OpenGL ES 2.0.
Straight from the docs:

Vertex and Fragment Programs​

Unity for Nintendo 3DS has vertex shader support based on OpenGL ES 2.0.

Fragment Shaders are converted into 3DS’s texture combiners automatically. However, occasionally some detail can be lost in translation, since the feature set is not identical between those two systems.
Thing is, not a single shader that I have looked on was working. All of them turned out to be either black/white colors. Citra, when loading, does not show any shaders being loaded, so that's my first red flag. I feel like I am missing out on something obvious, like a checkbox for making sure that unity compiles the shader code as well.

now as for the effect...it sounds like you want a blinking light effect in your texture correct?
Yessir, you are correct, these are the images:
base.png
1733519354511.png
1733519359793.png
(they don't do much apart from layer on top of one another - also, tell me, if you'd like the file itself, I will gladly share)
They are supposed to combine into two different textures and it makes it seem like it blinks.

Also know that using Time.deltaTime over very long periods of time on the 3DS can cause float point errors past a few hours - I wrote a custom time.deltatime shader script that would reset time based shaders after 30 mins. had the game running all night till morning with no float point errors. prior to that I had a jittery vertex jumbled mess.
Oh, glad to know :D. It's probably possible to reset that time or something similar, so that there are no float errors

Either way, thank you so far for the support! ^^
 
Last edited by Ventuaer,

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
The unity that I have (according to my docs) says that it should support OpenGL ES 2.0.
Straight from the docs:

Thing is, not a single shader that I have looked on was working. All of them turned out to be either black/white colors. Citra, when loading, does not show any shaders being loaded, so that's my first red flag. I feel like I am missing out on something obvious, like a checkbox for making sure that unity compiles the shader code as well.


Yessir, you are correct, these are the images: View attachment 474630View attachment 474631View attachment 474632(they don't do much apart from layer on top of one another - also, tell me, if you'd like the file itself, I will gladly share)
They are supposed to combine into two different textures and it makes it seem like it blinks.


Oh, glad to know :D. It's probably possible to reset that time or something similar, so that there are no float errors

Either way, thank you so far for the support! ^^
Oh you mean a blinking eye...not a blinking light. and it seems like you want the eyes to be emissive ( have a glowing effect ) is this correct?

The difference between the 2 effects here is one is using a static texture with a cycling color shift masked by alpha channel
a less complex version of this same effect would be to have a scrolling texture with a ramp color additively applied over the static texture to generate the pulse like effect.

( know what I said here is straight gibberish but that is what you would say to a artist :rofl: )

the 2 methods described above I have already made and work on 3DS hardware so those would be quick for me to help you do.

The other is cycling between 2 or more textures with an applied emissive effect at runtime. Very different shader.
I haven't messed with Realtime texture swapping to create a "blinking eye like effect" the emissive glow is super easy effect to make so that's not a problem. The texture swap is what I need to investigate.. I need to do this for my project as well so this will be mutually beneficial :)

An alternative method here rather than texture swapping and probably cheaper and the right away to do this would be to use an animated sprite sheet... tho one controlled by a script...humm thems some uncharted water for me..I have a feeling the sprite sheet is the proper way to go but I got to look it up.

Swapping textures on old console hardware was usually frowned upon.. It did happen but not often since it was expensive back then because of texture memory constraints...yeah I'm going to have to do some digging on this...

Ok now in regards to Unity shaders not working please see my old post about compatible 3DS unity shaders.
These shaders should show up normally on hardware. I don't use Citra anymore but for the brief time I did these shaders worked normally while in software mode ( horrible framerates ) didn't really dig to much into Citra maybe spent 4 hours messing with it then decided id rather use real hardware. it is the correct way to test, though I get the financial and quick test turnaround time of Citra vs copying and installing files to a 3DS.

Here is the link to working 3DS Unity Shaders:
https://gbatemp.net/threads/how-to-make-3ds-games-with-unity.441193/page-13#post-10303463
 

Ventuaer

Member
Newcomer
Joined
Aug 2, 2024
Messages
11
Trophies
0
Age
25
XP
74
Country
Czech Republic
Oh you mean a blinking eye...not a blinking light. and it seems like you want the eyes to be emissive ( have a glowing effect ) is this correct?
No no, sorry for the confusion, I just want a simple blink animation on the character. ^^
This is what I meant :) but this code fails to work on real hardware.

An alternative method here rather than texture swapping and probably cheaper and the right away to do this would be to use an animated sprite sheet... tho one controlled by a script...humm thems some uncharted water for me..I have a feeling the sprite sheet is the proper way to go but I got to look it up.
Huh, that's interesting, I will take a look as well ^^
One of the first implementations of "Blinking" animation was a quad placed right where the eye(s) would be. But since the area, where the eyes are on the model is curved, I decided to go away from it (apart from also having to implement mouth & other things).

Ok now in regards to Unity shaders not working please see my old post about compatible 3DS unity shaders.
These shaders should show up normally on hardware. I don't use Citra anymore but for the brief time I did these shaders worked normally while in software mode ( horrible framerates ) didn't really dig to much into Citra maybe spent 4 hours messing with it then decided id rather use real hardware. it is the correct way to test, though I get the financial and quick test turnaround time of Citra vs copying and installing files to a 3DS.

Here is the link to working 3DS Unity Shaders:
https://gbatemp.net/threads/how-to-make-3ds-games-with-unity.441193/page-13#post-10303463
Thank you, but I was more speaking about writing my own shader, since I would like more control over the model (eg. having to stack several PNGs as a texture or being able to change color of one layer of the png and then layer it on top).
There is a shader in one of the Importable packages, called "CombinerOverrideExample", this one.. fails as well as a material, out of the box, it just gets rendered as black. :(
 

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
got it!

try this:


No need to make a custom shader. I'm going to test it out myself too. all you need for this is a 1bit alpha shader or 32bit pending how you want the expressions to blend.

**UPDATE**
Oh YEAH! It works on hardware!
 
Last edited by Th3Travler,

Ventuaer

Member
Newcomer
Joined
Aug 2, 2024
Messages
11
Trophies
0
Age
25
XP
74
Country
Czech Republic
Oh damn!! Thank a lot! I will test it out asap when I get the chance. ^^ thank you once again!
Update: After a while, I finally made it work - it was a hassle, but worth it. But still wondering, why the shaders aren't working on the 3ds...
 
Last edited by Ventuaer,
  • Like
Reactions: Th3Travler

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
Oh damn!! Thank a lot! I will test it out asap when I get the chance. ^^ thank you once again!
Update: After a while, I finally made it work - it was a hassle, but worth it. But still wondering, why the shaders aren't working on the 3ds...
Glad you got it to work :)

The code you wrote is for a Surface shader - Surface shaders tend to be more Unity proprietary code that have a bunch of pre-packaged fragment shader code. Another way to phrase it is your using a shader script that has a prepackaged shader attached understands its a building block /template of shader code as opposed to raw shader code...least that is my understanding of it.

I think the 3DS shader converter script expects the shaders to be formatted as either a Texture combiner or Fragment shader. My guess is the Surface shader uses a bunch of prepackaged GL ES 2.0 or higher functions which straight up will not work on the 3DS.

Use GL ES 1.1 compliant fragment shaders / Texture combiner format. There are some simple Open GL ES 2.0 stuff that translates but combining multiple textures during the fragment portion of the shader can cause it not to convert down to Open GL ES 1.1

It is and was a common Pain Point for Unity 3DS developers. I been thinking about making a library for everyone in the 3DS Unity community but its no small undertaking and since I am self taught id like talk to a real shader programmer before releasing my shaders into the wild.
 
Last edited by Th3Travler,

Ventuaer

Member
Newcomer
Joined
Aug 2, 2024
Messages
11
Trophies
0
Age
25
XP
74
Country
Czech Republic
Glad you got it to work :)

The code you wrote is for a Surface shader - Surface shaders tend to be more Unity proprietary code that have a bunch of pre-packaged fragment shader code. Another way to phrase it is your using a shader script that has a prepackaged shader attached understands its a building block /template of shader code as opposed to raw shader code...least that is my understanding of it.

I think the 3DS shader converter script expects the shaders to be formatted as either a Texture combiner or Fragment shader. My guess is the Surface shader uses a bunch of prepackaged GL ES 2.0 or higher functions which straight up will not work on the 3DS.

Use GL ES 1.1 compliant fragment shaders / Texture combiner format. There are some simple Open GL ES 2.0 stuff that translates but combining multiple textures during the fragment portion of the shader can cause it not to convert down to Open GL ES 1.1

It is and was a common Pain Point for Unity 3DS developers. I been thinking about making a library for everyone in the 3DS Unity community but its no small undertaking and since I am self taught id like talk to a real shader programmer before releasing my shaders into the wild.
That's all very good points you have there!

From what I have seen, the OpenGL shaders should be as if native on the system, since they are written in C++, and while I can say that I am comfortable with c++, shaders aren't scope of my studies :D

Sad to see that shaders are kinda...wonky to say the least on the 3DS. I feel like some games had to make use of it, but I do not know which ones used unity and not nintendo's proprietary software if they have/had any
 
  • Like
Reactions: CooingMaxito

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
That's all very good points you have there!

From what I have seen, the OpenGL shaders should be as if native on the system, since they are written in C++, and while I can say that I am comfortable with c++, shaders aren't scope of my studies :D

Sad to see that shaders are kinda...wonky to say the least on the 3DS. I feel like some games had to make use of it, but I do not know which ones used unity and not nintendo's proprietary software if they have/had any
It took me a year to learn enough about shader code to write the shaders I got of course with the help of Chat GPT. Not to write the shader code cause it cant do it. Believe me I tried :rofl: but to help me understand enough about the code and its structure so Icould do it myself. Having a old school Art production background also also helps because I know what shaders you can and cant have on older tech and how to fake it since I had to back then. I wish I knew C++ currently I'm teaching myself C# and just coding structures in general. I wish I had studied this sooner in life...

Honesty the 3DS can do alot, its really quite impressive. but moderation is key. Yes normals yes vertex effects yes animated UVs yes dynamic lighting but you got to be very diligent about where and how effects are applied. Thing is tho most of the visual tricks have not been as tuorialized because it was just right before the era of sharing and YouTube.
Most of the more advanced shaders I have had to dig into websites made in 2010's era most of it unkept. really makes digging for information a challenge.

anything from Open GL 2.0 and on there are millions of tutorials and shader node editors its much easier but before than? Ps2 - Game cube era shaders? It was the wild west! shader programmers were the rarest breed. You understood Code AND Art?! Heresy! Day Walkers
a WITCH! lol yeah those old school tricks are very few and far between. Wish I could talk to some of those old production people fill a bunch of knowledge gaps I have.
 

CooingMaxito

Well-Known Member
Newcomer
Joined
Nov 18, 2023
Messages
58
Trophies
0
XP
360
Country
Mexico
It took me a year to learn enough about shader code to write the shaders I got of course with the help of Chat GPT. Not to write the shader code cause it cant do it. Believe me I tried :rofl: but to help me understand enough about the code and its structure so Icould do it myself. Having a old school Art production background also also helps because I know what shaders you can and cant have on older tech and how to fake it since I had to back then. I wish I knew C++ currently I'm teaching myself C# and just coding structures in general. I wish I had studied this sooner in life...

Honesty the 3DS can do alot, its really quite impressive. but moderation is key. Yes normals yes vertex effects yes animated UVs yes dynamic lighting but you got to be very diligent about where and how effects are applied. Thing is tho most of the visual tricks have not been as tuorialized because it was just right before the era of sharing and YouTube.
Most of the more advanced shaders I have had to dig into websites made in 2010's era most of it unkept. really makes digging for information a challenge.

anything from Open GL 2.0 and on there are millions of tutorials and shader node editors its much easier but before than? Ps2 - Game cube era shaders? It was the wild west! shader programmers were the rarest breed. You understood Code AND Art?! Heresy! Day Walkers
a WITCH! lol yeah those old school tricks are very few and far between. Wish I could talk to some of those old production people fill a bunch of knowledge gaps I have.
Wow! Looks like shaders in Unity 3ds are more specific and complicated than I thought...

I probably won't have use for them anytime soon since my current project is 2d with a consistent art style, but I guess I should start investigating and doing some trial an error sooner or later.

I will probably eventually need to make a custom shader if I want it to look a distinct way anyway, for another project in the who knows how far future, if I ever decide to do 3d.

Anyway it's really interesting to see other people's findings on this, since there's not enough documentation to use Unity 3ds to it's full capacity while keeping it efficient (in my opinion). Or at least that has been my experience with it so far, which is quite fun if I do say so myself! It's always a great feeling when I finally get something to work properly on hardware after bashing my head against the wall for a couple hours, oh Unity 3ds, you scallywag
 

Th3Travler

Well-Known Member
Newcomer
Joined
Dec 4, 2023
Messages
51
Trophies
0
XP
416
Country
Argentina
Wow! Looks like shaders in Unity 3ds are more specific and complicated than I thought...

I probably won't have use for them anytime soon since my current project is 2d with a consistent art style, but I guess I should start investigating and doing some trial an error sooner or later.

I will probably eventually need to make a custom shader if I want it to look a distinct way anyway, for another project in the who knows how far future, if I ever decide to do 3d.

Anyway it's really interesting to see other people's findings on this, since there's not enough documentation to use Unity 3ds to it's full capacity while keeping it efficient (in my opinion). Or at least that has been my experience with it so far, which is quite fun if I do say so myself! It's always a great feeling when I finally get something to work properly on hardware after bashing my head against the wall for a couple hours, oh Unity 3ds, you scallywag
There was a 3DS tutorial series made by Unity - covered a bunch of topics. I been scouring the web for it. It could be downloaded from the Dev forums. Someone has it on a hard drive somewhere! I just need to convince them to upload it :lol:

I do know that they were the bane of many 3DS Unity Dev's because of a bunch of deprecated Open GL ES 1.1 functions. If you had an in house Shader guy you were fine but most people starting with unity 3DS had it rough. Its kind of like Unity 3 - 4 those were rough times for shaders. back then I had no clue how to write them and I was used to Unreal 3's node based shader editor ahh what a time..These kids today with there insta map exports auto weathering, PBR and Deferred rendering engines with ambient occlusion and bounce lighting! you can actually build an entire forest to scale We had to bake everything! we had no speedtree, we had to match every texture by hand in our Froward rendering engine and we were grateful! because we didn't have to use brushes in q-radiant! Get off my digital LAWN! :lol:

What little I know I am happy to share so if you have shader /Graphics questions ask away. I cant promise I know the answer to all or that I'm an expert with the most efficient way to do it but I'll share what I got.

I haven't messed much with screen based effects ( post effect shaders ) which is what I'm guessing you might want on a 2d game. Maybe bloom and color correction are possible since that tech existed in GL ES 1.1 to a limited capacity. Its Ironic the 3DS GPU is capable of GL ES 2.0 effects but Nintendo cheaped out and didn't get the extended library so that's why the GPU can do some 2.0 shader instructions but cuts off on per pixel effects. least that's what I have understood..take it with a grain of salt :unsure:

here is the GPU demo video of the era:



btw CooingMaxito love the Undertale Port you are working on. is this project in unity?
Es muy impresionante
 
Last edited by Th3Travler,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    CoolMe @ CoolMe: @unpronouceablename now let me she them tits!