Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
Offline Matasx  
#25 Posted : Saturday, February 22, 2014 6:15:43 PM(UTC)
Matasx

Joined: 8/30/2013(UTC)
Posts: 43

Thanks: 11 times
Was thanked: 1 time(s) in 1 post(s)
Thanks. ThumpUp
Offline Benjamin  
#26 Posted : Thursday, February 27, 2014 10:30:53 AM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
To really stress test the issue you had I wrote a little new sample (can be found in the Samples directory and DeltaEngine and DeltaEngine.Samples solution): FractalZoomer (allows you to zoom into fractals and check them out with high rendering speed)
It updates the image used as many times as your CPU cores can handle (small resolution very often, higher resolution much less, but the bandwidth is not the issue here, calculating the image is). Tested with SharpDX (which the code posted above, optimization to only update the texture and not dispose and recreate it every time Fill is called is also on the way) and all other Delta Engine graphic frameworks, works very well.
FractalZoomer sample

A new nightly release is planned for later today, we are currently fixing the last couple of approval tests. In the past few days more has changed in graphics and rendering than in the last bunch of nightly releases where the focus was mostly on samples and build issues.

Edited by user Thursday, February 27, 2014 10:35:53 AM(UTC)  | Reason: included image, should be fully visible now

Benjamin attached the following image(s):
FractalZoomer.png (304kb) downloaded 184 time(s).

You cannot view/download attachments. Try to login or register.
Offline Matasx  
#27 Posted : Monday, March 17, 2014 1:12:18 PM(UTC)
Matasx

Joined: 8/30/2013(UTC)
Posts: 43

Thanks: 11 times
Was thanked: 1 time(s) in 1 post(s)
Hi. Thanks for update.
I'm currently using version 1.0.19 with function FillRgbaData(byte[] rgbaColors) (still SharpDX). It has the same bug as reported before. It uses only the first pixel from provided data to fill whole image (instead of using proper data for each pixel).
Offline Benjamin  
#28 Posted : Monday, March 17, 2014 11:27:20 PM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
As you can see in the screenshot above it was possible to pass many different pixel colors to an image. However we optimized the code by using subresources, but you are right, only the first column is passed in and the rest of the image is not updated. The fix is quite easy and will come today with the v1.0.20 release:

In SharpDXImage.cs replace
Code:

device.Context.UpdateSubresource(rgbaColors, NativeTexture);


with:
Code:

DataStream subResource;
device.Context.MapSubresource(NativeTexture, 0, MapMode.WriteDiscard, MapFlags.None, out subResource);
subResource.Write(rgbaColors, 0, rgbaColors.Length);
device.Context.UnmapSubresource(NativeTexture, 0);


plus create create the new texture (CreateNewTexture method this way):
Code:

private void CreateNewTexture()
{
	var description = new Texture2DDescription
	{
		Width = (int)PixelSize.Width,
		Height = (int)PixelSize.Height,
		ArraySize = 1,
		MipLevels = 1,
		Format = Format.R8G8B8A8_UNorm,
		Usage = ResourceUsage.Dynamic,
		CpuAccessFlags = CpuAccessFlags.Write,
		BindFlags = BindFlags.ShaderResource,
		SampleDescription = new SampleDescription(1, 0),
	};
	NativeTexture = new Texture2D(device.NativeDevice, description);
	SetSamplerState();
}


Hope this helps Blink
Offline Matasx  
#29 Posted : Friday, March 28, 2014 3:00:45 PM(UTC)
Matasx

Joined: 8/30/2013(UTC)
Posts: 43

Thanks: 11 times
Was thanked: 1 time(s) in 1 post(s)
I must use compiled libraries in my diploma thesis. So I must wait to the new release.
Anyway - is it possible, that fill function ignores Alpha channel?
When I set RGBA values like:
0 0 0 255 - the rendered result is Black - this is OK
0 0 0 0 - the rendered result is also Black (but it should be the color of object in the back)

Edited by user Friday, March 28, 2014 3:37:02 PM(UTC)  | Reason: Not specified

Offline Benjamin  
#30 Posted : Wednesday, April 2, 2014 5:25:09 AM(UTC)
Benjamin

Medals: Admin

Joined: 8/20/2011(UTC)
Posts: 1,421
Location: Hannover

Thanks: 18 times
Was thanked: 97 time(s) in 92 post(s)
Nightly versions provide binaries as well (nuget packages).

As you can see from the above code the texture should be in the RGBA format and using Color.TransparentBlack (0, 0, 0, 0) should work as you expect it. Maybe you did not set the BlendMode (Opaque will always render opaque, this is the fastest, but obviously you won't do any blending as you want with transparent pixels).

Here is some code:
Code:

[Test, ApproveFirstFrameScreenshot]
public void DrawCustomImageHalfTransparent()
{
	Resolve<Window>().BackgroundColor = Color.Yellow;
	var customImage = ContentLoader.Create<Image>(new ImageCreationData(new Size(64, 64)));
	customImage.Fill(new Color(0, 0, 0, 0.5f));
	customImage.BlendMode = BlendMode.Normal;
	new SolidSprite(customImage);
}


which results in this image (black half transparent image on top of a solid yellow background):
Benjamin attached the following image(s):
DrawCustomImageHalfTransparent.png (4kb) downloaded 16 time(s).

You cannot view/download attachments. Try to login or register.
Offline Matasx  
#31 Posted : Wednesday, April 2, 2014 9:18:50 AM(UTC)
Matasx

Joined: 8/30/2013(UTC)
Posts: 43

Thanks: 11 times
Was thanked: 1 time(s) in 1 post(s)
Thanks a lot!
customImage.BlendMode = BlendMode.Normal; did the job. Perfect. ThumpUp
Rss Feed  Atom Feed
Users browsing this topic
OceanSpiders 2.0
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2022, Yet Another Forum.NET
This page was generated in 0.058 seconds.