Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

► Texture Adjustments ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, May 20, 2015.

  1. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Cannot give any advice, sorry :oops:.
     
    Last edited: Jul 12, 2022
  2. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    996
    I would suggest moving over to command buffers to not only increase efficiency (since command buffers don't require as much interop as issuing individual commands), but also make it compatible with custom effects.

    Anything you can do outside of command buffers, you can do with command buffers.

    When using Apply() in an Adjustment, you could simply invoke Graphics.ExecuteCommandBuffer(). Adjustments could have a GetCommandBuffer() if the user wants to invoke the command buffer themselves somewhere else in their code (or add to camera).
     
    Last edited: Jul 13, 2022
    Arkhivrag likes this.
  3. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    71
    Hey @Arkhivrag

    I'm trying to send my output to a render texture already in my project, is this possible?

    Your included examples show how to apply the adjusted texture directly to the material of the current object. I would like to apply the adjusted texture to a render texture that I've already created so I can use it on any game object that has the render texture as the _MainTex in the material.

    My game has a character that is split up into multiple parts but uses the same material on each part. If I can send the adjusted texture output to a render texture it should update the render texture on the material.

    Please let me know if and how I can do this, thanks!

    Simon
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Actually, all package included example scripts demonstrate adjusting exactly RenderTexture (and not material or any other texture types).

    upload_2022-8-18_10-29-22.png

    That RenderTexture later is converted to the regular Texture2D to be used inside material.
     
  5. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    71
    This doesn't output to a render texture I have already created in my project. Is there any way to write to an existing render texture already in my project?
     
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Texture Adjustments renders everything and works only with RenderTextures. I do not understand what kind of problem you have.
    If in your project you already have RenderTexture, just use it in scripts (without declaring new one) or after using TA, copy content from adjusted RT to your RT.
     
    Last edited: Aug 18, 2022
  7. LuiBroDood

    LuiBroDood

    Joined:
    Mar 13, 2019
    Posts:
    84
    does this have ... batch .. invert roughness to smooth and put it into alpha layer of metallic ?
     
  8. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    If roughness = 1.0 - smoothness.

    Example:
    1) Source target texture is Metallic map. In its alpha channel you need to import smoothness.
    2) Importing Roughness map, using Channel Import filter.
    3) Invert its channel that you need (in this example Red) and choose the destination channel (in this example Alpha).
    upload_2022-10-12_11-0-5.png

    Now alpha channel of the Metallic map will contain invert red channel of the Roughness map.

    Try free demo version. All filters that work in the single mode, work in batch mode too.
    But in the case of the Channel Import filter, batch mode may not work as you expect, as it allows you to choose only one specific map that will be imported in all textures.
     
    Last edited: Oct 12, 2022
  9. Jayme65

    Jayme65

    Joined:
    Dec 11, 2016
    Posts:
    94
    At a time, there was a speed benchmark table for each "adjustments".
    I can't find it anymore (I don't remember if it was on the asset store pictures or documentation, .. ?)
    May you please remind me where I can find it please?
     
  10. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Adjustments speed calculation formula contained one very little, but fundamental mistake. I had to temporarily disable it.
     
  11. vacuumpacked

    vacuumpacked

    Joined:
    Apr 12, 2022
    Posts:
    1
    Hi, I have a render texture that I want to resize using Apply. The result ist darker than the original. The color space is linear. Unity version is 2021.2.10f1
     
  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Unity version 2021.2 is a 'tech release'. Try using the latest 2021.3 LTS version.

    When uing Unity 2021.3, do not copy asset from the old project to the new, instead clear Asset Store cache folder and re-download asset using package manager.
     
  13. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    125
    First of all thanks for the great asset, but after using it I started getting this warning that causes PC to crash:
    D3D11: Failed to create RenderTexture


    I'm using Texture Adjustments at runtime. Any ideas?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Unity version?
    Render pipeline?
    Build target?
    Color Space?
    OS?

    Which texture adjustments and settings are you using?
    Do the TA editor crashes if using the same settings?
     
  15. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    125
    Built-in
    Windows
    Linear
    Windows 11
    HSL

    I'm using Unity's Visual Scripting. Might happen because I'm scripting it in an unusual way. It's not game-breaking. Doesn't happen very often. Not easy to repro. Maybe I have to release resources on start or smth? Because it happens only after using Unity for a long time.
     
  16. claudius_I

    claudius_I

    Joined:
    May 28, 2017
    Posts:
    254
    Hello, how can i get a texture with this color. I want to create a atlas and need the texture with the correct color.

    there are a easy way to do that?

    Thanks
     

    Attached Files:

  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    Check editor log file after crash. It contains more info why it happens.



    Do you want to create new empty texture with selected color?
    upload_2023-2-20_0-9-21.png
     
  18. claudius_I

    claudius_I

    Joined:
    May 28, 2017
    Posts:
    254
    I want to create a new texture (using the base texture) to get the material with the same color without need to change the color in the shader

    y tried to use color overlay but dont get the same color
     
    Last edited: Feb 19, 2023
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    3,008
    If you need to multiple texture with a color:
    upload_2023-2-20_0-44-17.png
     
    claudius_I likes this.
  20. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    125
    Forgot to mention that I'm using 2021.3.19f1

    No. I'm editing an existing one. Actually, the crash is not crashing Unity normally. It's a RAM crash I think, everything becomes black for a short while and then gradually gets restored. Whole Windows crashes a bit actually. I haven't experienced it today, so it's not a big problem I guess.

    I had a ram leak until crash before because I was generating a new null texture every frame. I solved it by ticking mipmaps setting during both rendering and dst texture creation (UVS).

    But when this crash happens, it's instant and rare.

    I think it's pain to reproduce for both of us since it's not making big trouble it's ok, the build seems to be working fine.

    I will let you know if I discover clear repro steps or it becomes much worse.

    Thank you