Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question HLSL and CG Shaders

Discussion in 'Shaders' started by dave_m_moore, Mar 23, 2023.

  1. dave_m_moore

    dave_m_moore

    Joined:
    Jul 28, 2016
    Posts:
    39
    Hi,
    I wonder whether you guys can give me some pointers please.

    I've written shaders before but not for Unity. I've read that CG shaders are considered to be obsolete and that it should be better to write shaders using HLSL. However, when I create shaders in Unity (2021.2.16) via Create->Shader->...... all of these default shaders are CG shaders. No apparent default HLSL shaders are present.

    So my questions are:
    1). What are the downsides of using CG shaders, as it appears easier for a newbie to develop these from the default shader examples?
    2). If I use CG shaders, will they work on non-NVidia hardware?
    3). Are there any default HLSL shaders available that I can use as a base?

    Thanks for any pointers,
    Dave
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,631