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"

Canvas::DrawTile halves the texture color

The Canvas::DrawTile method halves the color my texture:

alt text

The left part of this image is a pure red texture (255,0,0), and when I render the canvas texture after using DrawTile, it is now 127. The right part are boxes drawn with DrawItem in the same canvas, and they are displayed correctly. In case it matter I use UCanvasRenderTarget2D.

Why is DrawTile transforming the color of my texture?

 FCanvasTileItem WhiteBox = FCanvasTileItem(FVector2D(0.0f, 0.0f), GWhiteTexture, FVector2D(Width, Height), FLinearColor(1.0f, 1.0f, 1.0f));
 Canvas->DrawItem(WhiteBox);
 
 FCanvasTileItem RedBox = FCanvasTileItem(FVector2D(Width * 0.1f, Height * 0.1f), GWhiteTexture, FVector2D(Width * 0.8f, Height * 0.8f), FLinearColor(1.0f, 0.0f, 0.0f));
 Canvas->DrawItem(RedBox);
 
 FCanvasTileItem GreenBox = FCanvasTileItem(FVector2D(Width * 0.2f, Height * 0.2f), GWhiteTexture, FVector2D(Width * 0.6f, Height * 0.6f), FLinearColor(0.0f, 1.0f, 0.0f));
 Canvas->DrawItem(GreenBox);
 
 FCanvasTileItem BlueBox = FCanvasTileItem(FVector2D(Width * 0.3f, Height * 0.3f), GWhiteTexture, FVector2D(Width * 0.4f, Height * 0.4f), FLinearColor(0.0f, 0.0f, 1.0f));
 Canvas->DrawItem(BlueBox);
 
 Canvas->DrawTile(Texture, 0, 0, SurfaceWidth / 2.0, SurfaceHeight, 0, 0, Texture->GetSurfaceWidth(), Texture->GetSurfaceHeight(), BLEND_Translucent);


Product Version: UE 4.8
Tags:
untitled-2.jpg (20.6 kB)
more ▼

asked Aug 26 '15 at 05:07 PM in Rendering

avatar image

deck57
16 1 4 9

avatar image deck57 Aug 26 '15 at 05:24 PM

This is because DrawColor is set to (127,127,127,255) by default. I just needed to call Canvas->SetDrawColor(255, 255, 255, 255); before DrawTile.

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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