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"

How do I access shadow maps?

Hello, I'm trying to access the shadow maps once I build the lighting, I know that I can see them in the editor in World Settings > Light Mass > Lightmaps. But I need to access the actual texture from c++ or BP.

I tried using AWorldSettings, but it contains everything beside the actual texture even if in the editor are shown there.

Product Version: UE 4.12
more ▼

asked Sep 04 '16 at 05:48 PM in C++ Programming

avatar image

92 14 21 24

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

1 answer: sort voted first

I have had issues with this myself, but so far I've found a way to at least get at the textures:

 TArray<UTexture2D*> LightMapsAndShadowMaps;
 World->GetLightMapsAndShadowMaps(World->GetCurrentLevel(), LightMapsAndShadowMaps);

You can then iterate over them and save them into their respective files. But the bitmap converters don't want to serialize shadow maps (because they are encoded as grayscale) and light maps are in what seems like a weird RLE BMP container (not vanilla, that's for sure).

This is what I've got within the iterator:

 FBufferArchive Buffer;
 bool bSuccess = FImageUtils::ExportTexture2DAsHDR(map, Buffer);
 if (bSuccess)
     ar->Serialize(const_cast<uint8*>(Buffer.GetData()), Buffer.Num());

Can share more code if you like but I also need help finding the UVs for these and actually exporting all of this shadow map data as a usable image file... :/

more ▼

answered Nov 21 '17 at 01:43 AM

avatar image

1 1 1

(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