Jump to content

Holograms & Holographs?


MadCat
 Share

Recommended Posts

To get you started: use a blue material (mode alpha) and some simple fragment-shader like this:

 

#version 400
//Uniforms
uniform sampler2D texture0;
uniform vec4 materialcolordiffuse;
uniform float currenttime;
//Inputs
in vec4 ex_color;
in vec2 texcoords0;
in float clipdistance0;
//Outputs
out vec4 fragData0;
void main()
{
//Clip plane discard
if (clipdistance0>0.0) discard;

fragData0 = ex_color * materialcolordiffuse;
fragData0.rgb += .2*sin(tan(texcoords0.y-currenttime*.008)*10)+.25;
fragData0.a = .5;
}

 

This does in fact look horrible. You will need some (maybe even a lot of) fine-tuning of the parameters, but it should give you an impression, how to create that flickering look.

Link to comment
Share on other sites

Hi

Thanks

I not a coder

But I can't get this to work, when you run it there is nothing there but it's shadow, you can see something when you shine the torch on it but it's not looking like a hologram, just some sort of shadow

Make sure this code goes in the fragment, not the vertex (there is a dropdown at the bottom).

Link to comment
Share on other sites

No, this is NOT a postprocessing-shader. This is a material-fragment-shader. To apply it do the following:

  1. Open up the material-editor for your hologram's material
     
  2. Set the Blend Mode to "alpha" and the diffuse color to some nice blue
     
  3. Go to the shaders-tab
     
  4. As the shader choose the one attached to this post (you should rename it to have ".shader" in the end, instead of ".txt"). The attached one has its vertex-shader and its fragment-shader already set (as they always have to fit together), so you don't have to do that anymore.

hologram.txt

Link to comment
Share on other sites

I was viewing in-game (Run Game)

 

hmm, strange, but if it works now, that doesn't matter...

 

Is there a way of slowing down the flicker?

 

With a bit of maths you can do anything wink.png. You will have to modify the shader:

Open up the shader in the shader editor (you can do so by clicking the icon with the pen in the material editor).

Make sure, you are editing the fragment shader (there is a selection box where you can switch between vertex/geometry/control/evaluation/fragment).

You should see the code I posted above (with a slight modification).

 

All the magic happens in this line:

fragData0.rgb += .2*sin(tan(texcoords0.y-currenttime*.008)*10)+.25

 

if you change the factor after currenttime (0.008), you can influence the speed. Just play around with the values there. If you e.g. want to have a regular pattern instead, you could also go ahead and just remove the "tan".

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...