x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Write to depth buffer from custom pixel shader?

Hi,

I want to render a plane but I want to write to the depth buffer using depth values stored inside a texture I send to the material. I know I can't do it using material blueprint (If i'm not mistaken), except for pixel depth offset which is not appropriate for my needs. I found a way to edit sources files to have a custom shading model, but I still can't write to the depth buffer.

My questions are : - Is it possible to write a custom vertex/pixel shader and use it ? I know there is FGlobalShader, but i don't want a post-process shader, and FVertexFactory use a vertex shader from what I know. And I didn't find an example for a material shader. - Is it possible to write to the depth buffer from a pixel shader or one of the source shader ?

Product Version: UE 4.12
Tags:
more ▼

asked Jul 22 '16 at 06:35 PM in Rendering

avatar image

keiko_
8 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

It is possible to write custom shader from scratch, yet extremely impractical. However, there is a Custom Depth buffer. Maybe you could use it to achive what you need.

more ▼

answered Jul 23 '16 at 03:50 PM

avatar image

Deathrey
7.8k 130 31 292

avatar image keiko_ Jul 25 '16 at 04:51 PM

Using the Custom Depth buffer is heavier because I just want to write to depth buffer but I'll give it a try. I didn't think about it because of the post-process pass I want to avoid.

Is the Custom Depth buffer usable in stereo for each eye ?

Thx for your answer!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question