Terrain: Transparency Shader

Questions à propos du scripting Shader.
Matt45400
Messages : 131
Inscription : 31 Oct 2013 12:58
Localisation : Orléans / Paris

Terrain: Transparency Shader

Message par Matt45400 » 12 Déc 2015 15:22

Bonjour à tous,

je cherche des techniques pour faire un "trou" dans le terrain de base. Je suis tombé sur ce shader, mais il ne semble pas fonctionner avec Unity 5. Je n'ai rien trouvé sur internet, si quelqu'un qui s'y connait en shader pouvait jeter un oeil merci !

Avatar de l’utilisateur
boubouk50
ModoGenereux
ModoGenereux
Messages : 6206
Inscription : 28 Avr 2014 11:57
Localisation : Saint-Didier-en-Bresse (71)

Re: Terrain: Transparency Shader

Message par boubouk50 » 14 Déc 2015 10:38

As-tu bien suivi les conditions d'utilisation?

Usage
Copy the shader code below and paste it into a new shader file within your project's Assets folder. (you can name it whatever you want)
Create a completely transparent image and add it as one of your terrain's textures.
Paint the transparent texture onto your terrain, and wherever you paint, the terrain will become transparent!
Notes:
+ For the transparency to work, you must place the transparent texture into one of the first four slots. (technical reason; the 'first pass' shader that is overridden can only access the first four splatmaps)
+ If you apply the transparent texture with only partial opacity, you can make existing textures 'partially transparency'.
+ To remove the transparency, just paint over it with another texture.
+ The terrain collider will still be active on transparent parts of the terrain. To fix this, you would need to make a script that disables the collider when the player is over a transparent area
"Ce n'est pas en améliorant la bougie, que l'on a inventé l'ampoule, c'est en marchant longtemps."
Nétiquette du forum
Savoir faire une recherche
Apprendre la programmation

Matt45400
Messages : 131
Inscription : 31 Oct 2013 12:58
Localisation : Orléans / Paris

Re: Terrain: Transparency Shader

Message par Matt45400 » 14 Déc 2015 14:04

Oui quand même merci, as-tu essayé de ton côté pour vérifier ?

Avatar de l’utilisateur
boubouk50
ModoGenereux
ModoGenereux
Messages : 6206
Inscription : 28 Avr 2014 11:57
Localisation : Saint-Didier-en-Bresse (71)

Re: Terrain: Transparency Shader

Message par boubouk50 » 14 Déc 2015 14:34

Je n'ai pas testé.
C'était pour savoir si tu avais bien suivi les instructions (nombre de gens qui ne font les choses qu'à moitié... :roll: ).

A noter, ce shader a été conçu pour la version 3.X d'Unity
Sinon recherche Google: http://answers.unity3d.com/questions/10 ... ators.html
"Ce n'est pas en améliorant la bougie, que l'on a inventé l'ampoule, c'est en marchant longtemps."
Nétiquette du forum
Savoir faire une recherche
Apprendre la programmation

Matt45400
Messages : 131
Inscription : 31 Oct 2013 12:58
Localisation : Orléans / Paris

Re: Terrain: Transparency Shader

Message par Matt45400 » 14 Déc 2015 17:11

Merci boubouk, déjà fait mais comme la personne qui posait cette question, ça ne résous pas le problème.
Finalement j'ai opté pour un depth mask, ça fonctionne très bien et l'avantage par rapport au transparent c'est que ça n'utilise pas de textures :)

Répondre

Revenir vers « les Shaders »