UI Toolkit

Reply

Issues with 3d + hud

[ Edited ]

I made a little 3d room and everything ran fine, then i decided to add a hud. 

First i copy-pasted the hello world example of the documentation then i used my own hud prototype made with the composer, in both cases the results are altered, infact they overridde my shader altering the trasparent pixels drawing policy(for testing reasons i want to draw them) and probably the "distance" instruction used to calculate the amount of light that affects a vertex.

 

this is the game on vita before the hud 

this is after

on the pc emulator the light is right but remains the problem with trasparent pixels.

 

Why the hud interfere with  my 3d settings? What can i do?

 

 

PS:

the hud makes nothing, i didn't add instructions, i only wanted to try to show it in the game.

Please use plain text.

Rif.: Issues with 3d + hud

Sometimes the pc emulator renders only walls, the skeleton and the hud.

Please use plain text.

Rif.: Issues with 3d + hud

Hi emanuevil81,

Thanks for the report. Are you able to test this on any other devices? Do you see the same behaviour?

Regarding your second post, is this inconsistency only when you have the UI displaying or does it happen without the UI too?

Thanks in advance,
James
PlayStation®Mobile Dev Team
Please use plain text.

Rif.: Issues with 3d + hud

I can test it only on my pc and psvita, sorry.

I have problems only with the ui, without it everything is fine.

Please use plain text.

Rif.: Issues with 3d + hud

> I can test it only on my pc and psvita, sorry.
So I take it you are seeing the same behaviour across both?

Are you able to paste the shader that you are using here?

Thanks,
James
PlayStation®Mobile Dev Team
Please use plain text.

Rif.: Issues with 3d + hud

This is the appmain class where i added the ui code, DEM is the class that makes everything and Hud is the class of my custom interface.

 

 

using System;
using System.Collections.Generic;

using Sce.Pss.Core;
using Sce.Pss.Core.Audio;
using Sce.Pss.Core.Environment;
using Sce.Pss.Core.Graphics;
using Sce.Pss.Core.Input;
using Sce.Pss.HighLevel.UI;

using provaui;

using Emalib;

namespace Prova
{
	public class AppMain
	{
		private static GraphicsContext graphics;
		private static DEM dem;
		private static hud h;
		
		public static void Main (string[] args)
		{
			Initialize ();
			
			while (true) {
				SystemEvents.CheckEvents ();
				Update ();
				Render ();
			}
		}

		public static void Initialize ()
		{
			// Set up the graphics system
			graphics = new GraphicsContext ();

			dem = new DEM(graphics);
			
            // Initialize UI Toolkit
            UISystem.Initialize(graphics);

            // TODO: Create scenes and call UISystem.SetScene
            // Scene myScene = new Sce.Pss.HighLevel.UI.Scene();
            // UISystem.SetScene(myScene, null);
            // Create scene
			h=new hud();

            // Set scene
            UISystem.SetScene(h, null);
		}

		public static void Update ()
		{            
			//dem.update2d();
			dem.update3d();
			          			
			// Query touch for current state
            List<TouchData> touchDataList = Touch.GetData (0);

			
			// Update UI Toolkit
			UISystem.Update(touchDataList); 
		}

		public static void Render ()
		{
			// Clear the screen
			graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f);
			graphics.Clear ();

			dem.render3d();
			
			// Render UI Toolkit
			UISystem.Render ();
			
			// Present the screen
			graphics.SwapBuffers ();
		}
	}
}

 this is the code of the shader

 

void main(	float4 in a_Position  : POSITION,
			float4 in a_Color     : COLOR,
			float2 in a_TexCoord  : TEXCOORD0,
			float4 out v_Position : POSITION,
			float2 out v_TexCoord : TEXCOORD0,
			float4 out v_Color    : COLOR0,
			float4 out prova      : COLOR1,
			uniform float4x4 WorldViewProj
		   )
{		
	v_Position	= mul( a_Position, WorldViewProj );
	v_TexCoord  = a_TexCoord;
	v_Color=a_Color;

	float4 temp;
	temp.x=temp.y=temp.z=temp.w=0;

	prova.r=distance(temp,v_Position);
	
	if(prova.r<=3)prova.r=0;
	else if(prova.r>5)prova.r=1;	
	else prova.r=(prova.r-3)/2;
	
	prova.g=prova.b=prova.r;
}

 

void main( 
			float2 in  v_TexCoord     : TEXCOORD0,
			float4 in  v_Color        : COLOR0,
			float4 in  prova          :COLOR1,
			float4 out Color	  	  : COLOR,
			uniform sampler2D Texture0 : TEXUNIT0)
{
	Color=tex2D(Texture0, v_TexCoord);
	
	/*if(Color.a == 0.0f)
	{
		discard;
	}
	else*/ 
	{
		Color-=prova;
	}
}

 

 



 

Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News